Skip to content

Commit ed4e5df

Browse files
christianaurichzmaduh95
authored andcommitted
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: #55154 Signed-off-by: Christian Aurich <christian.aurichzm@gmail.com> PR-URL: #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>
1 parent 2ca2fd5 commit ed4e5df

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

test/parallel/parallel.status

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ test-snapshot-reproducible: SKIP
3535
test-repl-user-error-handler: PASS, FLAKY
3636

3737
[$system==win32]
38-
# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475
39-
test-runner-coverage: PASS, FLAKY
4038
# https://github.com/nodejs/node/issues/59090
4139
test-inspector-network-fetch: PASS, FLAKY
4240
# https://github.com/nodejs/node/issues/59636
@@ -53,8 +51,6 @@ test-performance-function: PASS, FLAKY
5351
test-esm-loader-hooks-inspect-wait: PASS, FLAKY
5452

5553
[$system==linux && $arch==s390x]
56-
# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475
57-
test-runner-coverage: PASS, FLAKY
5854
# https://github.com/nodejs/node/issues/58353
5955
test-http2-debug: PASS, FLAKY
6056

@@ -116,8 +112,6 @@ test-fs-watch-ignore-mixed: SKIP
116112
test-fs-watch-ignore-regexp: SKIP
117113

118114
[$system==aix]
119-
# https://github.com/nodejs/node/issues/55154#issuecomment-5423571475
120-
test-runner-coverage: PASS, FLAKY
121115
# https://github.com/nodejs/node/issues/54346
122116
test-esm-loader-hooks-inspect-wait: PASS, FLAKY
123117
# https://github.com/nodejs/node/issues/65697

test/parallel/test-runner-coverage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ test('test coverage report', async (t) => {
116116

117117
test('test tap coverage reporter', skipIfNoInspector, async (t) => {
118118
await t.test('coverage is reported and dumped to NODE_V8_COVERAGE if present', (t) => {
119+
// A dump left here would match the negative checks below on pid reuse.
120+
t.after(() => tmpdir.refresh());
119121
const fixture = fixtures.path('test-runner', 'coverage.js');
120122
const args = [
121123
'--experimental-test-coverage',
@@ -154,6 +156,8 @@ test('test tap coverage reporter', skipIfNoInspector, async (t) => {
154156

155157
test('test spec coverage reporter', skipIfNoInspector, async (t) => {
156158
await t.test('coverage is reported and dumped to NODE_V8_COVERAGE if present', (t) => {
159+
// A dump left here would match the negative checks below on pid reuse.
160+
t.after(() => tmpdir.refresh());
157161
const fixture = fixtures.path('test-runner', 'coverage.js');
158162
const args = [
159163
'--experimental-test-coverage',

0 commit comments

Comments
 (0)