Skip to content

Commit ffdcd63

Browse files
committed
fix(ci): reject empty LCOV source paths
1 parent 93ed353 commit ffdcd63

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/scripts/verify-lcov.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function verifyLcov(content) {
1111
for (const line of content.split(/\r?\n/)) {
1212
if (line.startsWith("SF:")) {
1313
if (inRecord) throw new Error("LCOV source record is not terminated")
14+
if (!line.slice(3)) throw new Error("LCOV source path is empty")
1415
inRecord = true
1516
linesFound = undefined
1617
linesHit = undefined

src/scripts/verify-lcov.spec.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe("verifyLcov", () => {
88
})
99

1010
it.each([
11+
["an empty source path", "SF:\nLF:1\nLH:1\nend_of_record\n"],
1112
["an unterminated record", "SF:file.ts\nLH:1\n"],
1213
["a zero-hit report", "SF:file.ts\nLF:1\nLH:0\nend_of_record\n"],
1314
["a hit count outside a record", "LH:1\n"],

0 commit comments

Comments
 (0)