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
{{ message }}
Repository navigation
Report 0% coverage for untested files in a project (i.e., files matching some glob) #58887
Right now, the test runner with --experimental-code-coverage doesn't seem to include an entry in the report for files that were not tested at all — i.e., that didn't get loaded during the test execution — even if those files were matched by a --test-coverage-include glob.
This can make the report very misleading, as the reported "all files" coverage percentage can easily go up, even when actual coverage has gone down (i.e.,. because a new file was introduced with no tests at all).
I know this has been raised at least twicebefore, but there didn't seem to be any issue for it on the issue tracker, so I wanted to raise it here.
What is the feature you are proposing to solve the problem?
There should be some way to have these untested files show up in the report, but report 0% coverage. The effect (although not necessarily the implementation) would be similar to istanbul's --all option.
I'm not wedded to a particular API, but one reasonable option might be to have a --test-coverage-include-all flag that makes sure that any file matched by --test-coverage-include shows up in the report.
What alternatives have you considered?
As mentioned here, it's possible to sort of simulate this effect by passing a glob to node --test that covers all the files in the project. However, every file then gets run as a test file, which is a lot of extra overhead, as these files don't actually have any tests.
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
We discussed this in today's meeting, and the consensus was: A test should contain at least 1 case / sub-test
a test that fails to contain at least 1 test should
be marked todo (and reported as TODO etc)
otherwise, fail (it's clearly a mistake, and not failing hides that mistake)
a test that contains at least one case should report the result of that (pass, fail, skip, todo, etc)
This is a breaking change, so we're proposing immediately adding a flag (eg --test-fail-on-empty) to opt into this behaviour now, and then remove the flag and make that the default behaviour in the next major.
It was also an intentional decision to allow the test runner CLI to execute files without forcing the use of node:test in those files. If you are planning to enforce that, it would be nice to allow opting out of that new behavior.
I should have mentioned this in my previous comment, but https://node-tap.org/node-test-interop/ is an example of integrating with node:test or --test without using both.
Activity
avivkeller commentedon Jul 20, 2025
We moved our discussion tracker to different repository, so that link broke.
The TL;DR of that issue, if I recall correctly, was:
This inconsistency comes from V8. V8 doesn't include unimported files in the coverage report.
avivkeller commentedon Jul 20, 2025
Although, if we found a way to do this, definitely +1, it's the only blocker keeping us on
c8in some web repositories.github-actions commentedon Jan 17, 2026
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
github-actions commentedon Feb 16, 2026
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.
For more information on how the project manages feature requests, please consult the feature request management document.
mbarneyjr commentedon Feb 16, 2026
I don't think this issue should be closed.
1 remaining item
JakobJingleheimer commentedon Jul 29, 2026
Thanks for this!
We discussed this in today's meeting, and the consensus was: A test should contain at least 1 case / sub-test
todo(and reported as TODO etc)This is a breaking change, so we're proposing immediately adding a flag (eg
--test-fail-on-empty) to opt into this behaviour now, and then remove the flag and make that the default behaviour in the next major.cjihrig commentedon Jul 29, 2026
Code coverage is still experimental. There isn't really a need for all of that extra process.
cjihrig commentedon Jul 29, 2026
It was also an intentional decision to allow the test runner CLI to execute files without forcing the use of
node:testin those files. If you are planning to enforce that, it would be nice to allow opting out of that new behavior.JakobJingleheimer commentedon Jul 29, 2026
I think we settled on that in the meeting (the default would be "on", and there'd be an option to turn it "off").
cjihrig commentedon Jul 29, 2026
I should have mentioned this in my previous comment, but https://node-tap.org/node-test-interop/ is an example of integrating with
node:testor--testwithout using both.test_runner: add support for --test-coverage-include-all
test_runner: add support for --test-coverage-include-all
test_runner: add support for --test-coverage-include-all
test_runner: add support for --test-coverage-include-all