Skip to content

Conversation

@RajeshKumar11
Copy link

Summary

When using /* node:coverage ignore next */ comments, the coverage system correctly excluded lines from DA (line coverage) entries in LCOV output but still reported branches as uncovered (BRDA count=0).

This caused branch coverage to show incorrect percentages (e.g., 66% instead of 100%) when the uncovered branch path contained ignored lines, impacting CI/CD pipelines that enforce branch coverage thresholds.

Changes

The fix treats branches as covered when they have count === 0 but contain ignored lines (ignoredLines > 0). This matches the behavior of c8 and ensures ignored code doesn't penalize branch coverage.

Before:

BRDA:4,2,0,0  # uncovered branch at line 4
BRH:2         # only 2/3 branches hit (66%)

After:

BRDA:4,2,0,1  # branch treated as covered due to ignore comment
BRH:3         # all 3/3 branches hit (100%)

Test plan

  • Added regression test in test/parallel/test-runner-coverage.js
  • Test verifies that BRDA entries don't show 0 for ignored branches
  • Test verifies BRH equals BRF when ignored code is not executed

Fixes: #61586

When using `/* node:coverage ignore next */` comments, the coverage
system correctly excluded lines from DA (line coverage) entries in
LCOV output but still reported branches as uncovered (BRDA count=0).

This caused branch coverage to show incorrect percentages (e.g., 66%
instead of 100%) when the uncovered branch path contained ignored
lines, impacting CI/CD pipelines that enforce branch coverage thresholds.

The fix treats branches as covered when they have `count === 0` but
contain ignored lines (`ignoredLines > 0`). This matches the behavior
of c8 and ensures ignored code doesn't penalize branch coverage.

Fixes: nodejs#61586
@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 Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

2 participants