From 85f89a100ed2dd6e1ad8df71cbd7c0e45c37cc41 Mon Sep 17 00:00:00 2001 From: robobun Date: Mon, 6 Oct 2025 19:47:24 -0700 Subject: [PATCH] fix(test): lcov reporter now counts only executable lines (#23320) Fixes #12095 Manually confirmed to fix the case, but it would be better to have an automated test to compare default reporter output with lcov reporter output. --------- Co-authored-by: Claude Bot Co-authored-by: Claude Co-authored-by: pfg --- src/sourcemap/CodeCoverage.zig | 2 +- test/cli/test/__snapshots__/coverage.test.ts.snap | 4 ++-- test/cli/test/coverage.test.ts | 4 ++-- test/harness.ts | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sourcemap/CodeCoverage.zig b/src/sourcemap/CodeCoverage.zig index 2c4a13b657..bc4a8ee4be 100644 --- a/src/sourcemap/CodeCoverage.zig +++ b/src/sourcemap/CodeCoverage.zig @@ -252,7 +252,7 @@ pub const Report = struct { } // LF: lines found - try writer.print("LF:{d}\n", .{report.total_lines}); + try writer.print("LF:{d}\n", .{report.executable_lines.count()}); // LH: lines hit try writer.print("LH:{d}\n", .{report.lines_which_have_executed.count()}); diff --git a/test/cli/test/__snapshots__/coverage.test.ts.snap b/test/cli/test/__snapshots__/coverage.test.ts.snap index 51453dcac8..23af59233a 100644 --- a/test/cli/test/__snapshots__/coverage.test.ts.snap +++ b/test/cli/test/__snapshots__/coverage.test.ts.snap @@ -8,7 +8,7 @@ FNH:0 DA:2,19 DA:3,16 DA:4,1 -LF:5 +LF:3 LH:3 end_of_record TN: @@ -22,7 +22,7 @@ DA:9,0 DA:10,0 DA:11,1 DA:14,9 -LF:15 +LF:7 LH:5 end_of_record" `; diff --git a/test/cli/test/coverage.test.ts b/test/cli/test/coverage.test.ts index 1fa6a37482..87099ddc71 100644 --- a/test/cli/test/coverage.test.ts +++ b/test/cli/test/coverage.test.ts @@ -387,7 +387,7 @@ FNF:1 FNH:1 DA:2,11 DA:3,17 -LF:5 +LF:2 LH:2 end_of_record TN: @@ -401,7 +401,7 @@ DA:6,42 DA:7,39 DA:8,36 DA:9,2 -LF:10 +LF:7 LH:7 end_of_record" `); diff --git a/test/harness.ts b/test/harness.ts index f2504723c7..4f5663dfe9 100644 --- a/test/harness.ts +++ b/test/harness.ts @@ -60,6 +60,7 @@ export const bunEnv: NodeJS.Dict = { BUN_FEATURE_FLAG_EXPERIMENTAL_BAKE: "1", BUN_DEBUG_linkerctx: "0", WANTS_LOUD: "0", + AGENT: "false", }; const ciEnv = { ...bunEnv };