Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

test_runner: skip branches entirely on ignored lines#61845

Open
drtootsie wants to merge 1 commit intonodejs:mainnodejs/node:mainfrom
drtootsie:fix-coverage-ignore-branchesdrtootsie/node:fix-coverage-ignore-branchesCopy head branch name to clipboard
Open

test_runner: skip branches entirely on ignored lines#61845
drtootsie wants to merge 1 commit intonodejs:mainnodejs/node:mainfrom
drtootsie:fix-coverage-ignore-branchesdrtootsie/node:fix-coverage-ignore-branchesCopy head branch name to clipboard

Conversation

@drtootsie
Copy link

Fixes: #61586

Summary

When a branch is entirely on ignored lines (via c8 ignore comments), it should not appear in the BRDA output at all, rather than appearing with 0 coverage.

Changes

Modified the branch coverage logic in lib/internal/test_runner/coverage.js to check if all lines in the branch are ignored before:

  • Adding to branchReports array
  • Incrementing totalBranches counter

This ensures ignored branches don't pollute coverage reports.

Testing

Requires building Node.js and running the test suite:

./configure && make -j4
make test-only

Fixes: nodejs#61586

When a branch is entirely on ignored lines (via c8 ignore comments),
it should not appear in the BRDA output at all, rather than appearing
with 0 coverage.

Modified the branch coverage logic to check if all lines in the branch
are ignored before adding to branchReports and incrementing totalBranches.
This ensures ignored branches don't pollute coverage reports.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Feb 15, 2026
range.ignoredLines === range.lines.length) {
branchesCovered++;
// Skip branches that are entirely on ignored lines
if (range.ignoredLines !== range.lines.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please cover these changes with tests?

@JakobJingleheimer
Copy link
Member

I believe this is a duplicate of #61598

@JakobJingleheimer JakobJingleheimer added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate Issues and PRs that are duplicates of other issues or PRs. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_runner: node:coverage ignore comments exclude DA but leave BRDA in lcov output

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.