Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only set error codes when they are non zero #7363

Merged
merged 7 commits into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from 4 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Features

- `[jest-cli]` Only set error process error codes when they are non-zero ([#7363](https://github.com/facebook/jest/pull/7363))
SimenB marked this conversation as resolved.
Show resolved Hide resolved
- `[jest-validate]` Add support for comments in `package.json` using a `"//"` key [#7295](https://github.com/facebook/jest/pull/7295))
- `[jest-config]` Add shorthand for watch plugins and runners ([#7213](https://github.com/facebook/jest/pull/7213))
- `[jest-config]` [**BREAKING**] Deprecate `setupTestFrameworkScriptFile` in favor of new `setupFilesAfterEnv` ([#7119](https://github.com/facebook/jest/pull/7119))
Expand Down
7 changes: 5 additions & 2 deletions packages/jest-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ const readResultsAndExit = (
globalConfig: GlobalConfig,
) => {
const code = !result || result.success ? 0 : globalConfig.testFailureExitCode;

process.on('exit', () => (process.exitCode = code));

jcreamer898 marked this conversation as resolved.
Show resolved Hide resolved
// Only exit if needed
if (typeof code === 'number' && code !== 0) {
process.on('exit', () => (process.exitCode = code));
SimenB marked this conversation as resolved.
Show resolved Hide resolved
}

if (globalConfig.forceExit) {
if (!globalConfig.detectOpenHandles) {
Expand Down