Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/internal/test_runner/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,18 @@ class TestCoverage {
ObjectAssign(range, mapRangeToLines(range, lines));

if (isBlockCoverage) {
// If all lines in this range are ignored, report the branch as
// covered (count=1) instead of its actual V8 count. This matches
// the behavior of c8 and ensures the lcov output does not contain
// uncovered BRDA entries for ignored branches.
const count = range.ignoredLines === range.lines.length ? 1 : range.count;
ArrayPrototypePush(branchReports, {
__proto__: null,
line: range.lines[0]?.line,
count: range.count,
count,
});

if (range.count !== 0 ||
range.ignoredLines === range.lines.length) {
if (count !== 0) {
branchesCovered++;
}

Expand Down
Loading