diff --git a/src/index.js b/src/index.js index 83a0ef24..e0378ca5 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 711cbf75..f33a5e73 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 });