bcoe / bcoe/c8

Unreached lines of code in lib/parse-args.js

Open
#489 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

* **Version**:
* **Platform**:

* **Version**:
```
$ node -v
v16.19.1
```

* **Platform**:
```
$ uname -a
Linux ********* 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
```
The variable `argv.tempDirectory` is set in the following [yargs function](https://github.com/bcoe/c8/blob/a13584d5be5259ebb6a00455d352c3e8b16006de/lib/parse-args.js#L127C1-L130C7)

The [lines](https://github.com/bcoe/c8/blob/a13584d5be5259ebb6a00455d352c3e8b16006de/lib/parse-args.js#L163C1-L168C7) in the file lib/parse-args.js is not reached during the test cases and it references this variable.

| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
|--------------------------|---------|----------|---------|---------|--------------------------------------------------|
| All files | 95.84 | 86.33 | 100 | 95.84 | |
| bin | 90.38 | 88.88 | 100 | 90.38 | |
| c8.js | 90.38 | 88.88 | 100 | 90.38 | 27-29,50-51 |
| lib | 95.6 | 84.25 | 100 | 95.6 | |
| is-cjs-esm-bridge.js | 90 | 62.5 | 100 | 90 | 9 |
| parse-args.js | 98.21 | 75 | 100 | 98.21 | 165-166,201-202 |
| report.js | 95.44 | 90.54 | 100 | 95.44 | 9-10,123,129-132,143-147,248-249,332-333,367-369 |
| source-map-from-file.js | 91 | 71.42 | 100 | 91 | 74-76,91-93,95-97 |
| lib/commands | 100 | 95.45 | 100 | 100 | |
| check-coverage.js | 100 | 92.85 | 100 | 100 | 26 |
| report.js | 100 | 100 | 100 | 100 | |

The variable `process.env.NODE_V8_COVERAGE` is used as the default for `argv.tempDirectory` on [lines 127 - 130 in lib/parse-args.js](https://github.com/bcoe/c8/blob/a13584d5be5259ebb6a00455d352c3e8b16006de/lib/parse-args.js#L127C1-L130C7). Oddly enough `process.env.NODE_V8_COVERAGE` is assigned the value of the variable `argv.tempDirectory` [on line of 36 of
bin/c8.js](https://github.com/bcoe/c8/blob/a13584d5be5259ebb6a00455d352c3e8b16006de/bin/c8.js#L36C54-L36C54).

Need to investigate this issue further. Taking some notes as it is referenced in #436

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.