@@ -6,7 +6,7 @@ import { readAssets } from './helpers';
6
6
7
7
const FIXTURES_DIR = path . join ( __dirname , 'fixtures' ) ;
8
8
9
- describe ( 'apply function ' , ( ) => {
9
+ describe ( 'CopyPlugin ' , ( ) => {
10
10
describe ( 'basic' , ( ) => {
11
11
it ( 'should copy a file' , ( done ) => {
12
12
runEmit ( {
@@ -221,9 +221,7 @@ describe('apply function', () => {
221
221
. then ( done )
222
222
. catch ( done ) ;
223
223
} ) ;
224
- } ) ;
225
224
226
- describe ( 'difference path segment separation' , ( ) => {
227
225
it ( 'should work with linux path segment separation path when "from" is glob' , ( done ) => {
228
226
runEmit ( {
229
227
expectedAssetKeys : [ 'directory/nested/nestedfile.txt' ] ,
@@ -237,34 +235,6 @@ describe('apply function', () => {
237
235
. catch ( done ) ;
238
236
} ) ;
239
237
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
-
268
238
it ( 'should exclude path with linux path segment separators' , ( done ) => {
269
239
runEmit ( {
270
240
expectedAssetKeys : [
@@ -285,28 +255,6 @@ describe('apply function', () => {
285
255
. then ( done )
286
256
. catch ( done ) ;
287
257
} ) ;
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
- } ) ;
310
258
} ) ;
311
259
312
260
describe ( 'watch mode' , ( ) => {
@@ -538,33 +486,33 @@ describe('apply function', () => {
538
486
. catch ( done ) ;
539
487
} ) ;
540
488
} ) ;
541
- } ) ;
542
489
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' ] ;
561
493
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
+ ] ,
566
500
} )
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
+ } ) ;
569
517
} ) ;
570
518
} ) ;
0 commit comments