@@ -85,6 +85,22 @@ describe('apply function', () => {
85
85
// Get a mock compiler to pass to plugin.apply
86
86
const compiler = opts . compiler || new MockCompiler ( ) ;
87
87
88
+ const isWin = process . platform === 'win32' ;
89
+
90
+ if ( ! opts . symlink || isWin ) {
91
+ if ( ! opts . options ) {
92
+ // eslint-disable-next-line no-param-reassign
93
+ opts . options = { } ;
94
+ }
95
+
96
+ if ( ! opts . options . ignore ) {
97
+ // eslint-disable-next-line no-param-reassign
98
+ opts . options . ignore = [ ] ;
99
+ }
100
+
101
+ opts . options . ignore . push ( 'symlink/**/*' , 'file-ln.txt' , 'directory-ln' ) ;
102
+ }
103
+
88
104
new CopyPlugin ( opts . patterns , opts . options ) . apply ( compiler ) ;
89
105
90
106
// Call the registered function with a mock compilation and callback
@@ -657,6 +673,31 @@ describe('apply function', () => {
657
673
. then ( done )
658
674
. catch ( done ) ;
659
675
} ) ;
676
+
677
+ it ( 'can use a glob to move a file to the root directory from symbolic link' , ( done ) => {
678
+ runEmit ( {
679
+ // Windows doesn't support symbolic link
680
+ symlink : true ,
681
+ expectedAssetKeys :
682
+ process . platform === 'win32'
683
+ ? [ ]
684
+ : [
685
+ 'symlink/directory-ln/file.txt' ,
686
+ 'symlink/directory-ln/nested-directory/file-in-nested-directory.txt' ,
687
+ 'symlink/directory/file.txt' ,
688
+ 'symlink/directory/nested-directory/file-in-nested-directory.txt' ,
689
+ 'symlink/file-ln.txt' ,
690
+ 'symlink/file.txt' ,
691
+ ] ,
692
+ patterns : [
693
+ {
694
+ from : 'symlink/**/*.txt' ,
695
+ } ,
696
+ ] ,
697
+ } )
698
+ . then ( done )
699
+ . catch ( done ) ;
700
+ } ) ;
660
701
} ) ;
661
702
662
703
describe ( 'with file in from' , ( ) => {
@@ -1181,7 +1222,7 @@ describe('apply function', () => {
1181
1222
patterns : [
1182
1223
{
1183
1224
from : '**/*' ,
1184
- ignore : [ 'file.*' ] ,
1225
+ ignore : [ 'file.*' , 'file-in-nested-directory.*' ] ,
1185
1226
} ,
1186
1227
] ,
1187
1228
} )
@@ -1275,6 +1316,21 @@ describe('apply function', () => {
1275
1316
. then ( done )
1276
1317
. catch ( done ) ;
1277
1318
} ) ;
1319
+
1320
+ it ( 'can move a file (symbolic link) to the root directory' , ( done ) => {
1321
+ // Windows doesn't support symbolic link
1322
+ runEmit ( {
1323
+ symlink : true ,
1324
+ expectedAssetKeys : process . platform === 'win32' ? [ ] : [ 'file-ln.txt' ] ,
1325
+ patterns : [
1326
+ {
1327
+ from : 'symlink/file-ln.txt' ,
1328
+ } ,
1329
+ ] ,
1330
+ } )
1331
+ . then ( done )
1332
+ . catch ( done ) ;
1333
+ } ) ;
1278
1334
} ) ;
1279
1335
1280
1336
describe ( 'with directory in from' , ( ) => {
@@ -1612,6 +1668,24 @@ describe('apply function', () => {
1612
1668
. then ( done )
1613
1669
. catch ( done ) ;
1614
1670
} ) ;
1671
+
1672
+ it ( "can move a directory's contents to the root directory from symbolic link" , ( done ) => {
1673
+ runEmit ( {
1674
+ // Windows doesn't support symbolic link
1675
+ symlink : true ,
1676
+ expectedAssetKeys :
1677
+ process . platform === 'win32'
1678
+ ? [ ]
1679
+ : [ 'file.txt' , 'nested-directory/file-in-nested-directory.txt' ] ,
1680
+ patterns : [
1681
+ {
1682
+ from : 'symlink/directory-ln' ,
1683
+ } ,
1684
+ ] ,
1685
+ } )
1686
+ . then ( done )
1687
+ . catch ( done ) ;
1688
+ } ) ;
1615
1689
} ) ;
1616
1690
1617
1691
describe ( 'with simple string patterns' , ( ) => {
0 commit comments