deno: π `deno coverage` line and branch counts are incorrect
Iβm getting some broken coverage results.
For the code:
export function f(b: boolean) {
var result;
if (b) {
result = true;
} else {
result = false;
}
return result;
}
as a Deno script (from the repo https://github.com/rivy-t/cover-deno):
C:>deno test --unstable -A --coverage=coverage && deno coverage --unstable coverage --lcov
...
SF:C:\Users\Roy\OneDrive\Projects\deno\dexter\repo.t-cover-deno\src\mod.ts
FN:2,f
FNDA:4,f
FNF:1
FNH:1
BRDA:4,1,0,2
BRF:1
BRH:1
DA:1,2
DA:2,6
DA:3,6
DA:4,8
DA:5,8
DA:6,8
DA:7,6
DA:8,6
DA:9,2
LH:9
LF:9
end_of_record
vs the same code as ESM, using nyc/ava (from https://github.com/rivy-t/cover-esm):
C:>npm i --silent && npx nyc --silent ava && npx nyc report --reporter=text-lcov
...
TN:
SF:src\esm.js
FN:1,f
FNF:1
FNH:1
FNDA:2,f
DA:3,2
DA:4,1
DA:6,1
DA:8,2
LF:4
LH:4
BRDA:3,0,0,1
BRDA:3,0,1,1
BRF:2
BRH:2
end_of_record
Specifically, the Deno branch coverage is incorrect; the line coverage has odd counts, off-by-oneβs, and, arguably, counts non-executing lines.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 28 (27 by maintainers)
@bartlomieju is there any update on this ?
Iβm not sure about that, will get back to you once the PR lands.
Fixed URLs in the original post (GitHub didnβt like angle brackets around the GitHub URLs).