Skip to content

Coverage report missing for untested files #2674

@Idlesome

Description

@Idlesome

Describe the bug

When running a coverage report using instanbul or c8, modules that aren't tested aren't being shown in the report. This could mean I have a partially tested codebase but still get a 100% code coverage report. This could be particularly troublesome if you have a large codebase and a small number of files are not tested (e.g. after a refactor). These could be quite easily missed, while the user sees 100% code coverage.
In jest, this is usually solved with the "collectCoverageFrom" option which allows for specifying a pattern to match files that should be analysed for coverage. Perhaps a similar setting could be introduced.

Screen Shot 2023-01-15 at 20 29 18

Screen Shot 2023-01-15 at 20 29 09

Note: ErrorBoundary and FallbackComponent are used in the application but not imported by any .test.* module

Reproduction

To reproduce, run a coverage report using vitest with a module that is tested and a module that is not. The untested module does not appear in the coverage report, but it should as it may still be used by the application. This can lead to false coverage reports.
If further reproduction is required, I'm happy to submit a minimal reproduction sometime soon but need sleep right now..!

System Info

N/A

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions