Skip to content

Commit

Permalink
tests: add tests to ensure progress plugin is applied only once (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Aug 28, 2020
1 parent e8f2f20 commit fa1449c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/progress/index.js
@@ -0,0 +1 @@
console.log("Jotaro Kujo")
9 changes: 9 additions & 0 deletions test/progress/progress-flag.test.js
Expand Up @@ -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);
});
});
1 change: 0 additions & 1 deletion test/progress/src/index.js

This file was deleted.

6 changes: 6 additions & 0 deletions 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()],
};

0 comments on commit fa1449c

Please sign in to comment.