From 69be5338a8f72ffdbee055ab926cf4d84047fd35 Mon Sep 17 00:00:00 2001 From: Gert Sallaerts <1267900+GertSallaerts@users.noreply.github.com> Date: Wed, 17 Feb 2021 13:48:22 +0100 Subject: [PATCH] fix(fail-on-error): show eslint errors when failOnError is disabled (#85) --- src/index.js | 3 +++ test/fail-on-error.test.js | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/index.js b/src/index.js index 83a0ef2..e0378ca 100644 --- a/src/index.js +++ b/src/index.js @@ -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) { diff --git a/test/fail-on-error.test.js b/test/fail-on-error.test.js index 711cbf7..f33a5e7 100644 --- a/test/fail-on-error.test.js +++ b/test/fail-on-error.test.js @@ -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 });