diff --git a/test/parallel/test-runner-run-coverage.mjs b/test/parallel/test-runner-run-coverage.mjs index 89a9da2a179e44..5a70644a89d93c 100644 --- a/test/parallel/test-runner-run-coverage.mjs +++ b/test/parallel/test-runner-run-coverage.mjs @@ -154,10 +154,13 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, for await (const _ of stream); }); - await it('should run with coverage and fail when below line threshold', async () => { + await it('should run with coverage and fail when below line threshold', async (t) => { const thresholdErrors = []; const originalExitCode = process.exitCode; - assert.notStrictEqual(originalExitCode, 1); + t.after(() => { + process.exitCode = originalExitCode; + }); + process.exitCode = undefined; const stream = run({ files, coverage: true, @@ -178,7 +181,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, for await (const _ of stream); assert.deepStrictEqual(thresholdErrors.sort(), ['branch', 'function', 'line']); assert.strictEqual(process.exitCode, 1); - process.exitCode = originalExitCode; }); }); });