You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
I think if I am understanding correctly, this is "works as 'currently' designed" but agree it is confusing and should be documented. When c8 enables "coverage" it does so by telling node to do so via an environment variable (see https://github.com/bcoe/c8/blob/master/bin/c8.js#L36, you could supply it from the command line as well). Node then enables coverage on v8 via (I think...) the devtools protocol. Coverage is then written to a temp dir for everything that is flexed. I don't think there is a way to signal to node/v8 that it should only write data for specific files (to my current knowledge anyway).
c8 report then acts as a filter on the raw coverage data for what makes it into a report. In a sense, with -r none the --include flag is sort of a noop/invalid. (maybe we should verify and assert/warn on that). I guess the simplest way to support the expectation in the issue is to support a post-run, pre-report culling of the blobs based on include/exclude.
Edit to add: Or a command that more explicitly indicates the desire to run in two stages, like c8 cache-coverage that explicitly culls the output post run.
I'm working on an experimental loader hook for nyc to provide coverage of ES modules. Initially my scripts looked like:
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 thec8 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
?The text was updated successfully, but these errors were encountered: