Skip to content

Commit

Permalink
fix(fail-on-error): show eslint errors when failOnError is disabled (#85
Browse files Browse the repository at this point in the history
)
  • Loading branch information
GertSallaerts authored Feb 17, 2021
1 parent 4930a6f commit 69be533
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ class ESLintWebpackPlugin {
if (errors && options.failOnError) {
// @ts-ignore
compilation.errors.push(errors);
} else if (errors && !options.failOnError) {
// @ts-ignore
compilation.warnings.push(errors);
}

if (generateReportAsset) {
Expand Down
11 changes: 11 additions & 0 deletions test/fail-on-error.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ describe('fail on error', () => {
});
});

it('should emit warnings when disabled', (done) => {
const compiler = pack('error', { failOnError: false });

compiler.run((err, stats) => {
expect(err).toBeNull();
expect(stats.hasErrors()).toBe(false);
expect(stats.hasWarnings()).toBe(true);
done();
});
});

it('should correctly indentifies a success', (done) => {
const compiler = pack('good', { failOnError: true });

Expand Down

0 comments on commit 69be533

Please sign in to comment.