Skip to content

Commit 3715756

Browse files
authored
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
1 parent a7cba2f commit 3715756

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/output/defaults/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.export = 'output-flag-test';

test/output/defaults/output-defaults.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,18 @@ describe('output flag defaults', () => {
3131
done();
3232
});
3333
});
34+
it('should not throw when --defaults flag is passed', done => {
35+
const { stdout, stderr } = run(__dirname, ['--defaults'], false);
36+
const summary = extractSummary(stdout);
37+
console.log(stdout, stderr);
38+
const outputDir = 'defaults/dist';
39+
// When using --defaults it should not print warnings about config fallback
40+
expect(stderr).toBeFalsy();
41+
expect(summary['Output Directory']).toContain(outputDir);
42+
stat(resolve(__dirname, './dist/main.js'), (err, stats) => {
43+
expect(err).toBe(null);
44+
expect(stats.isFile()).toBe(true);
45+
done();
46+
});
47+
});
3448
});

0 commit comments

Comments
 (0)