Skip to content

test_runner: keep never-run blocks when merging coverage - #66873

Open
junaidkhan80121 wants to merge 1 commit into
nodejs:mainfrom
junaidkhan80121:fix/test-runner-coverage-merge-nested-blocks
Open

junaidkhan80121 wants to merge 1 commit into
nodejs:mainfrom
junaidkhan80121:fix/test-runner-coverage-merge-nested-blocks

Conversation

@junaidkhan80121

Copy link
Copy Markdown

Fixes: #66860

V8 omits a nested block when its count equals its parent. The previous
set-based merge dropped those never-run ranges when combining process
coverages, so a second less-covered process could make a failing branch
gate pass.

This switches function-range merging to a range-tree merge (same
approach as c8 / @bcoe/v8-coverage). Multi-process coverage for the
combined fixture now matches --test-isolation=none.

Test plan

  • ./out/Release/node test/parallel/test-runner-coverage-merge-nested.js
  • ./out/Release/node test/parallel/test-runner-coverage.js
  • ./out/Release/node test/parallel/test-runner-coverage-thresholds.js
  • Issue repro: one file fails 100% branch gate; two files still fail (same 80%)

AI assistance was used while drafting this change. I reviewed the
merge logic against the issue and @bcoe/v8-coverage, reproduced the
bug, verified the fix with a locally built Node, and ran the tests
above.

V8 omits a nested block when its count equals its parent. The old
set-based merge dropped those uncovered ranges across processes, so
coverage gates could pass. Merge with a range tree instead, matching
V8/c8 semantics.

Fixes: nodejs#66860
Signed-off-by: Junaid Khan <khanjunaid80121@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_runner: merging coverage across test processes drops never-run blocks, so coverage gates pass

2 participants