Skip to content

Commit

Permalink
feat(jest-runner): set exit code to 1 if test logs after teardown (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Nov 4, 2020
1 parent 6392dbd commit ddccb79
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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

0 comments on commit ddccb79

Please sign in to comment.