@@ -4,59 +4,84 @@ const { run, runWatch } = require('../utils/test-utils');
4
4
5
5
describe ( 'bail and watch warning' , ( ) => {
6
6
it ( 'should not log warning in not watch mode' , async ( ) => {
7
- const { stderr , stdout , exitCode } = await run ( __dirname , [ '-c' , 'bail-webpack.config.js' ] ) ;
7
+ const { exitCode , stderr , stdout } = await run ( __dirname , [ '-c' , 'bail-webpack.config.js' ] ) ;
8
8
9
9
expect ( exitCode ) . toEqual ( 0 ) ;
10
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
11
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
10
12
expect ( stderr ) . not . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
11
13
expect ( stdout ) . toBeTruthy ( ) ;
12
14
} ) ;
13
15
14
16
it ( 'should not log warning in not watch mode without the "bail" option' , async ( ) => {
15
- const { stderr , stdout , exitCode } = await run ( __dirname , [ '-c' , 'no-bail-webpack.config.js' ] ) ;
17
+ const { exitCode , stderr , stdout } = await run ( __dirname , [ '-c' , 'no-bail-webpack.config.js' ] ) ;
16
18
17
19
expect ( exitCode ) . toEqual ( 0 ) ;
20
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
21
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
18
22
expect ( stderr ) . not . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
19
23
expect ( stdout ) . toBeTruthy ( ) ;
20
24
} ) ;
21
25
22
26
it ( 'should not log warning in not watch mode without the "watch" option' , async ( ) => {
23
27
const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'watch-webpack.config.js' ] ) ;
24
28
29
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
30
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
25
31
expect ( stderr ) . not . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
26
32
expect ( stdout ) . toBeTruthy ( ) ;
27
33
} ) ;
28
34
29
35
it ( 'should not log warning without the "bail" option' , async ( ) => {
30
36
const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'no-bail-webpack.config.js' , '--watch' ] ) ;
31
37
38
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
39
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
32
40
expect ( stderr ) . not . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
33
41
expect ( stdout ) . toBeTruthy ( ) ;
34
42
} ) ;
35
43
36
44
it ( 'should not log warning without the "bail" option' , async ( ) => {
37
45
const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'no-bail-webpack.config.js' , '--watch' ] ) ;
38
46
47
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
48
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
39
49
expect ( stderr ) . not . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
40
50
expect ( stdout ) . toBeTruthy ( ) ;
41
51
} ) ;
42
52
43
53
it ( 'should log warning in watch mode' , async ( ) => {
44
54
const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'bail-webpack.config.js' , '--watch' ] ) ;
45
55
56
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
57
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
46
58
expect ( stderr ) . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
47
59
expect ( stdout ) . toBeTruthy ( ) ;
48
60
} ) ;
49
61
50
62
it ( 'should log warning in watch mode' , async ( ) => {
51
63
const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'bail-and-watch-webpack.config.js' ] ) ;
52
64
65
+ expect ( stderr ) . toContain ( 'Compilation starting...' ) ;
66
+ expect ( stderr ) . toContain ( 'Compilation finished' ) ;
53
67
expect ( stderr ) . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
54
68
expect ( stdout ) . toBeTruthy ( ) ;
55
69
} ) ;
56
70
57
71
it ( 'should log warning in case of multiple compilers' , async ( ) => {
58
- const { stderr, stdout } = await runWatch ( __dirname , [ '-c' , 'multi-webpack.config.js' ] ) ;
59
-
72
+ const { stderr, stdout } = await runWatch (
73
+ __dirname ,
74
+ [ '-c' , 'multi-webpack.config.js' ] ,
75
+ true ,
76
+ "Compiler 'second' is watching files for updates..." ,
77
+ ) ;
78
+
79
+ expect ( stderr ) . toContain ( "Compilation 'first' starting..." ) ;
80
+ expect ( stderr ) . toContain ( "Compilation 'first' finished" ) ;
81
+ expect ( stderr ) . toContain ( "Compiler 'first' is watching files for updates..." ) ;
82
+ expect ( stderr ) . toContain ( "Compilation 'second' starting..." ) ;
83
+ expect ( stderr ) . toContain ( "Compilation 'second' finished" ) ;
84
+ expect ( stderr ) . toContain ( "Compiler 'second' is watching files for updates..." ) ;
60
85
expect ( stderr ) . toContain ( `You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.` ) ;
61
86
expect ( stdout ) . toBeTruthy ( ) ;
62
87
} ) ;
0 commit comments