@@ -108,6 +108,7 @@ describe('apply function', () => {
108
108
{
109
109
assets : { } ,
110
110
errors : [ ] ,
111
+ warnings : [ ] ,
111
112
fileDependencies : new Set ( ) ,
112
113
contextDependencies : new Set ( ) ,
113
114
} ,
@@ -142,6 +143,13 @@ describe('apply function', () => {
142
143
} else if ( compilation . errors . length > 0 ) {
143
144
throw compilation . errors [ 0 ] ;
144
145
}
146
+
147
+ if ( opts . expectedWarnings ) {
148
+ expect ( compilation . warnings ) . toEqual ( opts . expectedWarnings ) ;
149
+ } else if ( compilation . warnings . length > 0 ) {
150
+ throw compilation . warnings [ 0 ] ;
151
+ }
152
+
145
153
resolve ( compilation ) ;
146
154
} )
147
155
. catch ( reject ) ;
@@ -206,6 +214,7 @@ describe('apply function', () => {
206
214
const compilation = {
207
215
assets : { } ,
208
216
errors : [ ] ,
217
+ warnings : [ ] ,
209
218
fileDependencies : new Set ( ) ,
210
219
contextDependencies : new Set ( ) ,
211
220
} ;
@@ -756,10 +765,12 @@ describe('apply function', () => {
756
765
it ( 'warns when file not found' , ( done ) => {
757
766
runEmit ( {
758
767
expectedAssetKeys : [ ] ,
759
- expectedErrors : [
760
- `[copy-webpack-plugin] unable to locate 'nonexistent.txt' at '${ HELPER_DIR } ${
761
- path . sep
762
- } nonexistent.txt'`,
768
+ expectedWarnings : [
769
+ new Error (
770
+ `[copy-webpack-plugin] unable to locate 'nonexistent.txt' at '${ HELPER_DIR } ${
771
+ path . sep
772
+ } nonexistent.txt'`
773
+ ) ,
763
774
] ,
764
775
patterns : [
765
776
{
@@ -775,10 +786,12 @@ describe('apply function', () => {
775
786
runEmit ( {
776
787
compiler : new MockCompilerNoStat ( ) ,
777
788
expectedAssetKeys : [ ] ,
778
- expectedErrors : [
779
- `[copy-webpack-plugin] unable to locate 'nonexistent.txt' at '${ HELPER_DIR } ${
780
- path . sep
781
- } nonexistent.txt'`,
789
+ expectedWarnings : [
790
+ new Error (
791
+ `[copy-webpack-plugin] unable to locate 'nonexistent.txt' at '${ HELPER_DIR } ${
792
+ path . sep
793
+ } nonexistent.txt'`
794
+ ) ,
782
795
] ,
783
796
patterns : [
784
797
{
@@ -1414,10 +1427,12 @@ describe('apply function', () => {
1414
1427
it ( 'warns when directory not found' , ( done ) => {
1415
1428
runEmit ( {
1416
1429
expectedAssetKeys : [ ] ,
1417
- expectedErrors : [
1418
- `[copy-webpack-plugin] unable to locate 'nonexistent' at '${ HELPER_DIR } ${
1419
- path . sep
1420
- } nonexistent'`,
1430
+ expectedWarnings : [
1431
+ new Error (
1432
+ `[copy-webpack-plugin] unable to locate 'nonexistent' at '${ HELPER_DIR } ${
1433
+ path . sep
1434
+ } nonexistent'`
1435
+ ) ,
1421
1436
] ,
1422
1437
patterns : [
1423
1438
{
0 commit comments