Skip to content

Commit

Permalink
fix: warning should not result in non-zero exit code (#1872)
Browse files Browse the repository at this point in the history
Co-authored-by: James George <jamesgeorge998001@gmail.com>
  • Loading branch information
snitin315 and jamesgeorge007 committed Oct 5, 2020
1 parent 77b7da5 commit ae9539d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -102,7 +102,7 @@ You can read more about [Scaffolding](https://webpack.js.org/guides/scaffolding)
| Exit Code | Description |
| --------- | -------------------------------------------------- |
| `0` | Success |
| `1` | Warnings/Errors from webpack |
| `1` | Errors from webpack |
| `2` | Configuration/options problem or an internal error |

## Contributing and Internal Documentation
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/lib/utils/Compiler.js
Expand Up @@ -53,7 +53,7 @@ class Compiler {
logger.error(err.stack || err);
process.exit(1); // eslint-disable-line
}
if (!outputOptions.watch && (stats.hasErrors() || stats.hasWarnings())) {
if (!outputOptions.watch && stats.hasErrors()) {
process.exitCode = 1;
}
if (outputOptions.json === true) {
Expand Down
2 changes: 1 addition & 1 deletion test/loader/warning-test/loader-warning.test.js
Expand Up @@ -8,6 +8,6 @@ describe('loader warning test', () => {

expect(stdout).toContain('[1 warning]');
expect(stdout).toContain('This is a warning');
expect(exitCode).not.toEqual(0);
expect(exitCode).toEqual(0);
});
});
3 changes: 3 additions & 0 deletions test/loader/warning-test/webpack.config.js
Expand Up @@ -27,4 +27,7 @@ module.exports = {
'my-loader': require.resolve('./my-loader'),
},
},
performance: {
hints: 'warning',
},
};

0 comments on commit ae9539d

Please sign in to comment.