-
-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add flag to force start finish log (#2566)
- Loading branch information
Showing
5 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Itadori Yuuji") |
50 changes: 50 additions & 0 deletions
50
test/build/start-finish-force-log/start-finish-force-log.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
const { run, runWatch, isWebpack5 } = require('../../utils/test-utils'); | ||
|
||
describe('start finish force log', () => { | ||
it('start finish force log when env is set', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, [], { | ||
env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, | ||
}); | ||
expect(exitCode).toBe(0); | ||
expect(stderr).toContain('Compiler starting...'); | ||
expect(stderr).toContain('Compiler finished'); | ||
const output = isWebpack5 ? 'compiled successfully' : 'main.js'; | ||
expect(stdout).toContain(output); | ||
}); | ||
|
||
it('should show name of the config', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['--name', 'log config'], { | ||
env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, | ||
}); | ||
expect(exitCode).toBe(0); | ||
expect(stderr).toContain("Compiler 'log config' starting..."); | ||
expect(stderr).toContain("Compiler 'log config' finished"); | ||
const output = isWebpack5 ? 'compiled successfully' : 'main.js'; | ||
expect(stdout).toContain(output); | ||
}); | ||
|
||
it('should work with watch', async () => { | ||
const { stderr, stdout } = await runWatch(__dirname, ['watch'], { | ||
env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, | ||
}); | ||
expect(stderr).toContain('Compiler starting...'); | ||
expect(stderr).toContain('Compiler finished'); | ||
const output = isWebpack5 ? 'compiled successfully' : 'main.js'; | ||
expect(stdout).toContain(output); | ||
}); | ||
|
||
it('should work with multi compiler', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['--config', './webpack.config.array.js'], { | ||
env: { WEBPACK_CLI_START_FINISH_FORCE_LOG: true }, | ||
}); | ||
expect(exitCode).toBe(0); | ||
expect(stderr).toContain("Compiler 'Gojou' starting..."); | ||
expect(stderr).toContain("Compiler 'Satoru' starting..."); | ||
expect(stderr).toContain("Compiler 'Gojou' finished"); | ||
expect(stderr).toContain("Compiler 'Satoru' finished"); | ||
const output = isWebpack5 ? 'compiled successfully' : 'main.js'; | ||
expect(stdout).toContain(output); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = [ | ||
{ | ||
name: 'Gojou', | ||
mode: 'development', | ||
}, | ||
{ | ||
name: 'Satoru', | ||
mode: 'development', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
mode: 'development', | ||
}; |