bcoe / bcoe/c8

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

Open
#473 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Example:

test.js:

```js
import './main.js';
```

main.js:

```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`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.