Skip to content

Report 0% coverage for untested files in a project (i.e., files matching some glob) #58887

@ethanresnick

Description

@ethanresnick

What is the problem this feature will solve?

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 twice before, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.never-staleMark issue so that it is never considered stalestale

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions