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

feat(jest-runner): set exit code to 1 if test logs after teardown #10728

Merged
merged 3 commits into from Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
### Features

- `[jest-config]` [**BREAKING**] Default to Node testing environment instead of browser (JSDOM) ([#9874](https://github.com/facebook/jest/pull/9874))
- `[jest-runner]` [**BREAKING**] set exit code to 1 if test logs after teardown ([#10728](https://github.com/facebook/jest/pull/10728))

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/consoleAfterTeardown.test.ts
Expand Up @@ -13,7 +13,7 @@ test('console printing', () => {
const {stderr, exitCode} = runJest('console-after-teardown');
const {rest} = extractSummary(stderr);

expect(exitCode).toBe(0);
expect(exitCode).toBe(1);

const withoutTrace = rest.split('\n').slice(0, -3).join('\n');

Expand Down
3 changes: 1 addition & 2 deletions packages/jest-runner/src/runTest.ts
Expand Up @@ -61,8 +61,7 @@ function freezeConsole(
);

process.stderr.write('\n' + formattedError + '\n');
// TODO: set exit code in Jest 25
// process.exitCode = 1;
process.exitCode = 1;
};
}

Expand Down