Skip to content

Conversation

@JeevanYewale
Copy link

Issue

When using /* node:coverage ignore next */ comments, the DA (line coverage) entries are correctly excluded from the LCOV output, but BRDA (branch coverage) entries for branches leading to ignored lines remain as uncovered. This causes false branch coverage failures.

Problem

  • DA entries are excluded
  • BRDA entries are NOT excluded
  • Results in incorrect branch coverage percentages (e.g., 66.67% instead of 100%)
  • Breaks CI/CD pipelines with branch coverage thresholds

Solution

Modified lib/internal/test_runner/coverage.js to exclude branches that are entirely on ignored lines from the branch coverage totals, matching the behavior of line coverage exclusion.

Changes

Testing

The fix can be verified with the minimal reproduction case from the issue:
https://github.com/tobigumo/node-coverage-brda-bug

@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 3, 2026
@MoLow
Copy link
Member

MoLow commented Feb 3, 2026

Please add/adjust tests (might want for ci completion to see if there are any failures, or just run python3 tools/test.py "test/test-runner/*" and python3 tools/test.py "test/parallel/test-runner-*)

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.72%. Comparing base (3fc542e) to head (48310bc).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61648      +/-   ##
==========================================
- Coverage   89.72%   89.72%   -0.01%     
==========================================
  Files         674      674              
  Lines      204360   204363       +3     
  Branches    39269    39265       -4     
==========================================
+ Hits       183370   183372       +2     
- Misses      13301    13302       +1     
  Partials     7689     7689              
Files with missing lines Coverage Δ
lib/internal/test_runner/coverage.js 73.03% <100.00%> (+0.11%) ⬆️

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

3 participants