fix: exclude branches on ignored lines from coverage reports#61648
Open
JeevanYewale wants to merge 1 commit intonodejs:mainfrom
Open
fix: exclude branches on ignored lines from coverage reports#61648JeevanYewale wants to merge 1 commit intonodejs:mainfrom
JeevanYewale wants to merge 1 commit intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Member
|
Please add/adjust tests (might want for ci completion to see if there are any failures, or just run |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Solution
Modified
lib/internal/test_runner/coverage.jsto exclude branches that are entirely on ignored lines from the branch coverage totals, matching the behavior of line coverage exclusion.Changes
branchReportsif they are not entirely on ignored linesTesting
The fix can be verified with the minimal reproduction case from the issue:
https://github.com/tobigumo/node-coverage-brda-bug