test: deflake test-runner-coverage

The subtests that set NODE_V8_COVERAGE leave a coverage-<pid>-*.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 <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65728
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Christian Aurich authored and GitHub committed 2026-09-03 23:54:01 +00:00
1 parent 53234233ac
commit 82fc59d4cb
2 files changed
+4 -6

No files matched your search

-6
View File
@@ -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
+4
View File
@@ -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',