diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1f8926045a..c054d76233f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/e2e/__tests__/consoleAfterTeardown.test.ts b/e2e/__tests__/consoleAfterTeardown.test.ts index fb1b6fa68b92..6f6d2e111381 100644 --- a/e2e/__tests__/consoleAfterTeardown.test.ts +++ b/e2e/__tests__/consoleAfterTeardown.test.ts @@ -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'); diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index 4770bf5369c5..bd2c6fc92cc6 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -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; }; }