Skip to content

Commit 69c6071

Browse files
committed
test_runner: report ignored branches as covered in lcov output
1 parent b345a17 commit 69c6071

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/internal/test_runner/coverage.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,18 @@ class TestCoverage {
263263
ObjectAssign(range, mapRangeToLines(range, lines));
264264

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

272-
if (range.count !== 0 ||
273-
range.ignoredLines === range.lines.length) {
277+
if (count !== 0) {
274278
branchesCovered++;
275279
}
276280

0 commit comments

Comments
 (0)