diff --git a/test/progress/index.js b/test/progress/index.js new file mode 100644 index 00000000000..278b015b7f7 --- /dev/null +++ b/test/progress/index.js @@ -0,0 +1 @@ +console.log("Jotaro Kujo") diff --git a/test/progress/progress-flag.test.js b/test/progress/progress-flag.test.js index 4328dcac858..4ada05f138f 100644 --- a/test/progress/progress-flag.test.js +++ b/test/progress/progress-flag.test.js @@ -9,4 +9,13 @@ describe('progress flag', () => { expect(stderr).toContain('[webpack.Progress] 100%'); expect(stdout).toContain('main.js'); }); + + it('should not add duplicate plugins', () => { + const { stderr, stdout, exitCode } = run(__dirname, ['-c', 'webpack.progress.config.js', '--progress']); + // Only 1 progress plugin should be applied to the compiler + expect(stdout.match(/ProgressPlugin/g)).toHaveLength(1); + expect(stderr).toContain('[webpack.Progress] 100%'); + expect(stdout).toContain('main.js'); + expect(exitCode).toEqual(0); + }); }); diff --git a/test/progress/src/index.js b/test/progress/src/index.js deleted file mode 100644 index 7cf2d037de0..00000000000 --- a/test/progress/src/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log('progress flag test'); diff --git a/test/progress/webpack.progress.config.js b/test/progress/webpack.progress.config.js new file mode 100644 index 00000000000..71900b279b4 --- /dev/null +++ b/test/progress/webpack.progress.config.js @@ -0,0 +1,6 @@ +const { ProgressPlugin } = require('webpack'); +const WebpackCLITestPlugin = require('../utils/webpack-cli-test-plugin'); + +module.exports = { + plugins: [new ProgressPlugin({}), new WebpackCLITestPlugin()], +};