Skip to content

Commit

Permalink
tests: respect cli args when config is an array (#2198)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Dec 7, 2020
1 parent ec42606 commit 0e37183
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/config/type/array/array.test.js
Expand Up @@ -3,7 +3,7 @@ const { existsSync } = require('fs');
const { resolve } = require('path');
const { run } = require('../../../utils/test-utils');

describe('array', () => {
describe('array config', () => {
it('is able to understand a configuration file in array format', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['-c', resolve(__dirname, 'webpack.config.js')], false);

Expand All @@ -16,4 +16,18 @@ describe('array', () => {
expect(existsSync(resolve(__dirname, './dist/dist-commonjs.js'))).toBeTruthy();
expect(existsSync(resolve(__dirname, './dist/dist-amd.js'))).toBeTruthy();
});

it('respect cli args with config as an array', () => {
const { exitCode, stderr, stdout } = run(__dirname, ['--stats', 'none'], false);

expect(exitCode).toBe(0);
expect(stderr).toContain("Compilation 'amd' starting...");
expect(stderr).toContain("Compilation 'amd' finished");
expect(stderr).toContain("Compilation 'commonjs' starting...");
expect(stderr).toContain("Compilation 'commonjs' finished");
// should not print anything because of stats: none
expect(stdout).toBeFalsy();
expect(existsSync(resolve(__dirname, './dist/dist-commonjs.js'))).toBeTruthy();
expect(existsSync(resolve(__dirname, './dist/dist-amd.js'))).toBeTruthy();
});
});
2 changes: 2 additions & 0 deletions test/config/type/array/webpack.config.js
Expand Up @@ -7,6 +7,7 @@ module.exports = [
name: 'amd',
entry: './a.js',
mode: 'development',
stats: 'verbose',
devtool: 'eval-cheap-module-source-map',
},
{
Expand All @@ -17,6 +18,7 @@ module.exports = [
name: 'commonjs',
entry: './a.js',
mode: 'development',
stats: 'detailed',
target: 'node',
},
];

0 comments on commit 0e37183

Please sign in to comment.