c8
c8 copied to clipboard
`if`, `while`, etc. body without braces not always reported in `% Stmts`, `% Lines`, or `Uncovered Line #s`
Example:
test.js:
import './main.js';
main.js:
if (false)
void 0;
if (false) {
void 0;
}
while (false)
void 0;
while (false) {
void 0;
}
npx c8 node test.js
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 69.23 | 20 | 100 | 69.23 |
main.js | 69.23 | 20 | 100 | 69.23 | 5-6,12-13
----------|---------|----------|---------|---------|-------------------
Note how in this case, the if and while bodies with braces are reported under Uncovered Line #s, and factor in to % Stmts and % Lines, while the if and while bodies without braces aren't (although they all seem to factor in to % Branch)