|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const { runWatch, isWebpack5 } = require('../../utils/test-utils'); |
| 4 | + |
| 5 | +describe('stats and watch', () => { |
| 6 | + it('should not log stats with the "none" value from the configuration', async () => { |
| 7 | + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--color']); |
| 8 | + |
| 9 | + expect(stdout).toContain('[webpack-cli] [32mCompilation starting...[39m'); |
| 10 | + expect(stdout).toContain('[webpack-cli] [32mCompilation finished[39m'); |
| 11 | + expect(stdout).toContain('[webpack-cli] [32mwatching files for updates...[39m'); |
| 12 | + expect(stderr).toBeFalsy(); |
| 13 | + }); |
| 14 | + |
| 15 | + it('should not log stats with the "none" value from the configuration and multi compiler mode', async () => { |
| 16 | + const { stderr, stdout } = await runWatch(__dirname, ['-c', './multi-webpack.config.js', '--color']); |
| 17 | + |
| 18 | + expect(stdout).toContain('[webpack-cli] [32mCompilation starting...[39m'); |
| 19 | + expect(stdout).toContain('[webpack-cli] [32mCompilation finished[39m'); |
| 20 | + expect(stdout).toContain('[webpack-cli] [32mwatching files for updates...[39m'); |
| 21 | + expect(stderr).toBeFalsy(); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should log stats with the "normal" value in arguments', async () => { |
| 25 | + const { stderr, stdout } = await runWatch(__dirname, ['-c', './webpack.config.js', '--stats', 'normal', '--color']); |
| 26 | + |
| 27 | + const output = isWebpack5 ? 'successfully' : 'main.js'; |
| 28 | + |
| 29 | + expect(stdout).toContain('[webpack-cli] [32mCompilation starting...[39m'); |
| 30 | + expect(stdout).toContain('[webpack-cli] [32mCompilation finished[39m'); |
| 31 | + expect(stdout).toContain('[webpack-cli] [32mwatching files for updates...[39m'); |
| 32 | + expect(stdout).toContain(output); |
| 33 | + expect(stderr).toBeFalsy(); |
| 34 | + }); |
| 35 | +}); |
0 commit comments