c8 icon indicating copy to clipboard operation
c8 copied to clipboard

`if`, `while`, etc. body without braces not always reported in `% Stmts`, `% Lines`, or `Uncovered Line #s`

Open MaxNanasy opened this issue 2 years ago • 0 comments

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)

MaxNanasy avatar May 23 '23 07:05 MaxNanasy