From 34ea4c165b401f7b1eec93767a63676ed5ba34d1 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Wed, 28 Oct 2020 14:01:36 +0530 Subject: [PATCH] set exitcode to 1 if tests log after teardown --- e2e/__tests__/consoleAfterTeardown.test.ts | 2 +- packages/jest-runner/src/runTest.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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 85aadd468329..b636adf94806 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; }; }