Skip to content

Commit

Permalink
tests(webpack-cli): add test case for defaults flag (#1254)
Browse files Browse the repository at this point in the history
* tests(output): add test case for default output

* tests(output): add index.js file for default config

* tests(output): fix comment typo
  • Loading branch information
anshumanv authored Feb 22, 2020
1 parent a7cba2f commit 3715756
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/output/defaults/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.export = 'output-flag-test';
14 changes: 14 additions & 0 deletions test/output/defaults/output-defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});

0 comments on commit 3715756

Please sign in to comment.