@@ -6,7 +6,7 @@ import { readAssets } from './helpers';
66
77const FIXTURES_DIR = path . join ( __dirname , 'fixtures' ) ;
88
9- describe ( 'apply function ' , ( ) => {
9+ describe ( 'CopyPlugin ' , ( ) => {
1010 describe ( 'basic' , ( ) => {
1111 it ( 'should copy a file' , ( done ) => {
1212 runEmit ( {
@@ -221,9 +221,7 @@ describe('apply function', () => {
221221 . then ( done )
222222 . catch ( done ) ;
223223 } ) ;
224- } ) ;
225224
226- describe ( 'difference path segment separation' , ( ) => {
227225 it ( 'should work with linux path segment separation path when "from" is glob' , ( done ) => {
228226 runEmit ( {
229227 expectedAssetKeys : [ 'directory/nested/nestedfile.txt' ] ,
@@ -237,34 +235,6 @@ describe('apply function', () => {
237235 . catch ( done ) ;
238236 } ) ;
239237
240- // Windows path segment (\\) can not use as path segment in glob, but can use as dirname at linux
241- it . skip ( 'should work with windows path segment separation path when "from" is glob' , ( done ) => {
242- runEmit ( {
243- expectedAssetKeys : [ 'directory/nested/nestedfile.txt' ] ,
244- patterns : [
245- {
246- from : 'directory\\nested\\*' ,
247- } ,
248- ] ,
249- } )
250- . then ( done )
251- . catch ( done ) ;
252- } ) ;
253-
254- // Windows path segment (\\) can not use as path segment in glob, but can use as dirname at linux
255- it . skip ( 'should work with mixed path segment separation path when "from" is glob' , ( done ) => {
256- runEmit ( {
257- expectedAssetKeys : [ 'directory/nested/nestedfile.txt' ] ,
258- patterns : [
259- {
260- from : 'directory/nested\\*' ,
261- } ,
262- ] ,
263- } )
264- . then ( done )
265- . catch ( done ) ;
266- } ) ;
267-
268238 it ( 'should exclude path with linux path segment separators' , ( done ) => {
269239 runEmit ( {
270240 expectedAssetKeys : [
@@ -285,28 +255,6 @@ describe('apply function', () => {
285255 . then ( done )
286256 . catch ( done ) ;
287257 } ) ;
288-
289- // Windows path segment (\\) can not use as path segment in glob, but can use as dirname at linux
290- it . skip ( 'should exclude path with windows path segment separators' , ( done ) => {
291- runEmit ( {
292- expectedAssetKeys : [
293- '[!]/hello.txt' ,
294- '[special?directory]/(special-*file).txt' ,
295- '[special?directory]/directoryfile.txt' ,
296- '[special?directory]/nested/nestedfile.txt' ,
297- 'dir (86)/file.txt' ,
298- 'dir (86)/nesteddir/deepnesteddir/deepnesteddir.txt' ,
299- 'dir (86)/nesteddir/nestedfile.txt' ,
300- ] ,
301- patterns : [
302- {
303- from : '!(directory)\\**\\*.txt' ,
304- } ,
305- ] ,
306- } )
307- . then ( done )
308- . catch ( done ) ;
309- } ) ;
310258 } ) ;
311259
312260 describe ( 'watch mode' , ( ) => {
@@ -538,33 +486,33 @@ describe('apply function', () => {
538486 . catch ( done ) ;
539487 } ) ;
540488 } ) ;
541- } ) ;
542489
543- describe ( 'logging' , ( ) => {
544- it ( 'should logging' , ( done ) => {
545- const expectedAssetKeys = [ 'file.txt' ] ;
546-
547- run ( {
548- patterns : [
549- {
550- from : 'file.txt' ,
551- } ,
552- ] ,
553- } )
554- . then ( ( { compiler, stats } ) => {
555- const root = path . resolve ( __dirname ) . replace ( / \\ / g, '/' ) ;
556- const logs = stats . compilation . logging
557- . get ( 'copy-webpack-plugin' )
558- . map ( ( entry ) =>
559- entry . args [ 0 ] . replace ( / \\ / g, '/' ) . split ( root ) . join ( '.' )
560- ) ;
490+ describe ( 'logging' , ( ) => {
491+ it ( 'should logging' , ( done ) => {
492+ const expectedAssetKeys = [ 'file.txt' ] ;
561493
562- expect (
563- Array . from ( Object . keys ( readAssets ( compiler , stats ) ) ) . sort ( )
564- ) . toEqual ( expectedAssetKeys ) ;
565- expect ( { result : logs } ) . toMatchSnapshot ( { result : logs } ) ;
494+ run ( {
495+ patterns : [
496+ {
497+ from : 'file.txt' ,
498+ } ,
499+ ] ,
566500 } )
567- . then ( done )
568- . catch ( done ) ;
501+ . then ( ( { compiler, stats } ) => {
502+ const root = path . resolve ( __dirname ) . replace ( / \\ / g, '/' ) ;
503+ const logs = stats . compilation . logging
504+ . get ( 'copy-webpack-plugin' )
505+ . map ( ( entry ) =>
506+ entry . args [ 0 ] . replace ( / \\ / g, '/' ) . split ( root ) . join ( '.' )
507+ ) ;
508+
509+ expect (
510+ Array . from ( Object . keys ( readAssets ( compiler , stats ) ) ) . sort ( )
511+ ) . toEqual ( expectedAssetKeys ) ;
512+ expect ( { result : logs } ) . toMatchSnapshot ( { result : logs } ) ;
513+ } )
514+ . then ( done )
515+ . catch ( done ) ;
516+ } ) ;
569517 } ) ;
570518} ) ;
0 commit comments