/
bail.test.js
63 lines (46 loc) · 2.51 KB
/
bail.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'use strict';
const { run, runWatch } = require('../utils/test-utils');
describe('bail and watch warning', () => {
it('should not log warning in not watch mode', async () => {
const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'bail-webpack.config.js']);
expect(exitCode).toEqual(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
});
it('should not log warning in not watch mode without the "bail" option', async () => {
const { exitCode, stderr, stdout } = await run(__dirname, ['-c', 'no-bail-webpack.config.js']);
expect(exitCode).toEqual(0);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
});
it('should not log warning in not watch mode without the "watch" option', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'watch-webpack.config.js']);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
});
it('should not log warning without the "bail" option', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'no-bail-webpack.config.js', '--watch']);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
});
it('should not log warning without the "bail" option', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'no-bail-webpack.config.js', '--watch']);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
});
it('should log warning in watch mode', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'bail-webpack.config.js', '--watch']);
expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`);
expect(stdout).toBeTruthy();
});
it('should log warning in watch mode', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'bail-and-watch-webpack.config.js']);
expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`);
expect(stdout).toBeTruthy();
});
it('should log warning in case of multiple compilers', async () => {
const { stderr, stdout } = await runWatch(__dirname, ['-c', 'multi-webpack.config.js'], true);
expect(stderr).toContain(`You are using "bail" with "watch". "bail" will still exit webpack when the first error is found.`);
expect(stdout).toBeTruthy();
});
});