From 0e37183dffabf2acb5779d3af02186d387663aae Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 7 Dec 2020 16:05:42 +0530 Subject: [PATCH] tests: respect cli args when config is an array (#2198) --- test/config/type/array/array.test.js | 16 +++++++++++++++- test/config/type/array/webpack.config.js | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/config/type/array/array.test.js b/test/config/type/array/array.test.js index c4757aa379f..5cb2267e933 100644 --- a/test/config/type/array/array.test.js +++ b/test/config/type/array/array.test.js @@ -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); @@ -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(); + }); }); diff --git a/test/config/type/array/webpack.config.js b/test/config/type/array/webpack.config.js index ffc4f604abb..e8ca27db5fa 100644 --- a/test/config/type/array/webpack.config.js +++ b/test/config/type/array/webpack.config.js @@ -7,6 +7,7 @@ module.exports = [ name: 'amd', entry: './a.js', mode: 'development', + stats: 'verbose', devtool: 'eval-cheap-module-source-map', }, { @@ -17,6 +18,7 @@ module.exports = [ name: 'commonjs', entry: './a.js', mode: 'development', + stats: 'detailed', target: 'node', }, ];