bcoe / bcoe/c8

Surprising handling of CLI include/exclude compared to nyc

Open
#204 1 comment 0 reactions 0 assignees View on GitHub
bug help wanted p2
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

* **Version**: 7.1.0
* **Platform**: Fedora 30 x86_64

I'm working on an experimental loader hook for nyc to provide coverage of ES modules. Initially my scripts looked like:
```js
{
"test": "c8 --include index.js -r none node test/index.js | tap-yaml-summary",
"posttest": "c8 report"
}
```

Running `c8 report` in a follow-up process was done to allow the text report to display in color (piping into tap-yaml-summary would normally disable color).

I was surprised to find that the `--include index.js` (restricting by include) did not work. It seems include/exclude options have no effect on coverage collection, instead it only controls coverage reporting. Once I moved the `--include index.js` to the `c8 report` it produced the expected report.

I don't know if the functionality can be improved or if this could just be documented. Maybe recommend against controlling include/exclude using CLI arguments in favor of `.c8rc.json`?

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.