New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vitest/C8 coverage includes the unit test files themselves #1612
Comments
@lloydjatkinson Hey Lloyd, please try excluding the spec files in the coverage config options as follows:
All you need is the exclude config. |
It should already be excluded. We have |
Which begs the question, what happens if you do in-source testing? I love that feature, and I can't leave it. |
@sheremet-va PR is here: #1627 |
If this isn't fixed by #1627 I'd suggest making a new issue. |
Describe the bug
As per the docs I have the following npm script to generate the coverage report:
However it includes the unit test files themselves which is not useful and also leads to incorrect coverage metrics. Please can this be addressed in Vite?
Reproduction
Follow getting started guide and make a basic function and a unit test that imports that function. Have
"coverage": "vitest run --coverage"
in npm scrips and run it. Observe the reports in both the console and HTML istanbul report contain both SUT's and the unit tests themselves.System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: