-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Coverage report does not include .vue files #680
Comments
https://github.com/bcoe/c8#checking-for-full-source-coverage-using---all
export default defineConfig({
test: {
coverage: {
all: true
}
},
}) |
Thank you @Demivan I think I've already done that |
Your repository page returns 404. Is it private? |
Sorry, my bad, should be public now. |
https://github.com/bcoe/c8/blob/ff01cd832a155494892b24c30c5a1c8f0169fd8e/lib/report.js#L197 Looks like |
Thanks @Demivan, opened an issue here: |
I experience the same issue. Does anyone have a workaround until it gets fixed? |
@kouts @brzezinskimarcin @Demivan for me it's working This is what I have on vite.config
|
@kouts @brzezinskimarcin @Demivan |
Peeky had custom code before but it was too much work to implement istanbul and I just switched to c8 for the coverage report. |
Looks like there is already an opened PR in c8's repository. Still yet to be approved and merged tho 🫤 |
I created a Stackblitz demo that reproduces this. |
Co-authored-by: Anthony Fu <[email protected]>
C8 already merged the PR that will make this possible. |
I'm using [email protected] and have [email protected] installed. It seems now that my coverage does show all of the .vue files that I don't have tests for in the coverage report, but almost all are showing 100%. Weirdly there are a couple files that are still at zero. We made some major App changes yesterday so maybe that's affecting it, since I'm pretty sure yesterday we were seeing the files but they were listed at 0% covered. But... seems weird that today they would go to 100%, unless coverage just isn't being calculated correctly in .vue files? I'm kind of lost here, so I'm curious what others are seeing. |
For me, the coverage of .vue files is also inaccurate. For some files it shows 100%, for others it shows low value while the file is just a static component with no script section or any conditionals/looping in template section, few cases show accurate coverage. This is a repo that shows some success/failure cases of coverage : Coverage html report on replit : |
Are you solved it? I have the same issue. |
I'm having the same issue, a lot of my .vue files have 100% coverage while some have 0%, none of them have any tests associated with them, but they report a coverage of "1x". Maybe because it's being executed somewhere secretly? Or perhaps because I'm using Typescript and SFCs? The Istanbul provider is doing a lot better and seems to not have the same issue. |
So after a bit of researching, it seems that the template is not taken into account when calculating the coverage. This means that only the script is counted as coverage and if your component only has logic in the template (with |
@kouts is this issue still valid? The reproduction case seems to work as expected:
@mahmost your reproduction case seems to work fine with changes of on-going PR #2591. It's having the same issue as #2539.
Maybe it's time to close this issue and open new ones if there are still existing problems. |
Hi @AriPerkkio, unfortunately, i am still experiencing this issue and have opened a new issue here. i have tried using both |
Describe the bug
The coverage seems to only cover
.vue
files that are currently tested, giving wrong coverage reports since files without tests are not covered.Possible related issues/PRs
#559
#518
Reproduction
https://github.com/kouts/vitest-coverage
running
npm run coverage
gives us the followingwhile it should include the uncovered
src/Hello.vue
componentSystem Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: