From 37157565d1d9892d5ff7ecbdcfacd00b884c4e33 Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Sun, 23 Feb 2020 00:52:56 +0530 Subject: [PATCH] tests(webpack-cli): add test case for defaults flag (#1254) * tests(output): add test case for default output * tests(output): add index.js file for default config * tests(output): fix comment typo --- test/output/defaults/index.js | 1 + test/output/defaults/output-defaults.test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/output/defaults/index.js diff --git a/test/output/defaults/index.js b/test/output/defaults/index.js new file mode 100644 index 00000000000..51aa40ce33d --- /dev/null +++ b/test/output/defaults/index.js @@ -0,0 +1 @@ +module.export = 'output-flag-test'; diff --git a/test/output/defaults/output-defaults.test.js b/test/output/defaults/output-defaults.test.js index 78ecdee881a..5a9121d9337 100644 --- a/test/output/defaults/output-defaults.test.js +++ b/test/output/defaults/output-defaults.test.js @@ -31,4 +31,18 @@ describe('output flag defaults', () => { done(); }); }); + it('should not throw when --defaults flag is passed', done => { + const { stdout, stderr } = run(__dirname, ['--defaults'], false); + const summary = extractSummary(stdout); + console.log(stdout, stderr); + const outputDir = 'defaults/dist'; + // When using --defaults it should not print warnings about config fallback + expect(stderr).toBeFalsy(); + expect(summary['Output Directory']).toContain(outputDir); + stat(resolve(__dirname, './dist/main.js'), (err, stats) => { + expect(err).toBe(null); + expect(stats.isFile()).toBe(true); + done(); + }); + }); });