Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/webpack-cli/__tests__/StatsGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('StatsGroup', function () {
]);

const result = group.run();
expect(result.options.stats).toBeFalsy();
expect(result.outputOptions.json).toBeTruthy();
});
});
2 changes: 1 addition & 1 deletion packages/webpack-cli/lib/groups/StatsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class StatsGroup extends GroupHelper {
} else {
if (this.args.verbose) {
this.opts.options.stats = 'verbose';
} else if (!StatsGroup.validOptions().includes(this.args.stats)) {
} else if (this.args.stats && !StatsGroup.validOptions().includes(this.args.stats)) {
logger.warn(`'${this.args.stats}' is invalid value for stats. Using 'normal' option for stats`);
this.opts.options.stats = 'normal';
} else {
Expand Down
11 changes: 11 additions & 0 deletions test/json/json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ describe('json flag', () => {
// check the JSON is valid.
expect(parseJson).not.toThrow();
});

it('should return valid json with -j alias', () => {
const { stdout } = run(__dirname, ['-j']);

// helper function to check if JSON is valid
const parseJson = () => {
return JSON.parse(stdout);
};
// check the JSON is valid.
expect(parseJson).not.toThrow();
});
});