From 4d8c8c346dc5a892d1cfd4ebff8b74593520b190 Mon Sep 17 00:00:00 2001 From: Christian Aurich Date: Tue, 1 Sep 2026 20:08:15 -0300 Subject: [PATCH] test: deflake test-runner-coverage The subtests that set NODE_V8_COVERAGE leave a coverage--*.json file in the test tmpdir, and nothing removes it. The later subtests spawn without NODE_V8_COVERAGE, so their coverage goes to a private mkdtemp directory that is removed on cleanup rather than to the test tmpdir. A match in findCoverageFileForPid(result.pid) can therefore only come from a stale file whose pid has been reused, which is why the failures are only reported on platforms that recycle pids quickly. Refresh the tmpdir from an after() hook on each subtest that dumps into it, so a failure in one of them cannot leave the file behind and turn every later check into a second, misleading failure. Drop the flaky designations. Fixes: https://github.com/nodejs/node/issues/55154 Signed-off-by: Christian Aurich --- test/parallel/parallel.status | 6 ------ test/parallel/test-runner-coverage.js | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 5f45d1ecdccd..1954c1b0f5bd 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -20,8 +20,6 @@ test-fs-read-stream-concurrent-reads: PASS, FLAKY test-snapshot-incompatible: SKIP [$system==win32] -# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475 -test-runner-coverage: PASS, FLAKY # https://github.com/nodejs/node/issues/59090 test-inspector-network-fetch: PASS, FLAKY # https://github.com/nodejs/node/issues/59636 @@ -38,8 +36,6 @@ test-performance-function: PASS, FLAKY test-esm-loader-hooks-inspect-wait: PASS, FLAKY [$system==linux && $arch==s390x] -# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475 -test-runner-coverage: PASS, FLAKY # https://github.com/nodejs/node/issues/58353 test-http2-debug: PASS, FLAKY @@ -101,8 +97,6 @@ test-fs-watch-ignore-mixed: SKIP test-fs-watch-ignore-regexp: SKIP [$system==aix] -# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475 -test-runner-coverage: PASS, FLAKY # https://github.com/nodejs/node/issues/54346 test-esm-loader-hooks-inspect-wait: PASS, FLAKY # https://github.com/nodejs/node/issues/65697 diff --git a/test/parallel/test-runner-coverage.js b/test/parallel/test-runner-coverage.js index bc65221a45f8..fa56c5af3e80 100644 --- a/test/parallel/test-runner-coverage.js +++ b/test/parallel/test-runner-coverage.js @@ -116,6 +116,8 @@ test('test coverage report', async (t) => { test('test tap coverage reporter', skipIfNoInspector, async (t) => { await t.test('coverage is reported and dumped to NODE_V8_COVERAGE if present', (t) => { + // A dump left here would match the negative checks below on pid reuse. + t.after(() => tmpdir.refresh()); const fixture = fixtures.path('test-runner', 'coverage.js'); const args = [ '--experimental-test-coverage', @@ -154,6 +156,8 @@ test('test tap coverage reporter', skipIfNoInspector, async (t) => { test('test spec coverage reporter', skipIfNoInspector, async (t) => { await t.test('coverage is reported and dumped to NODE_V8_COVERAGE if present', (t) => { + // A dump left here would match the negative checks below on pid reuse. + t.after(() => tmpdir.refresh()); const fixture = fixtures.path('test-runner', 'coverage.js'); const args = [ '--experimental-test-coverage',