Code coverage seems to be collected incorrectly
See original GitHub issueI am looking to upgrade several projects to Vue 3 and I am running into an interesting issue when collecting code coverage. For some reason, when switching to Vue 3, the code coverage statistics are incorrect, but the tests are running correctly. Below is a repository that minimally reproduces the issue I am running into. Also attached are a couple of screenshots that show the difference in coverage between Vue 2 and Vue 3.
https://github.com/sam-pastoriza/vue-3-coverage
With Vue 2, you get the following coverage in the repo. With Vue 3, you get the following coverage, without changing the tests.
A readme file in that repository details how I switch between Vue 2 and Vue 3.
A couple of notes on the structure of the project I am working with.
- We use
vue-class-component
as a library. I don’t think this is causing the issue, but I could be wrong. - We are required to split up the components into separate .ts and .vue files.
Many thanks for the help. Hopefully this is the right place to post this issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:17 (10 by maintainers)
Top GitHub Comments
This is most likely a bug in
vue-jest
which isn’t handling source maps correctly - test utils just provides some basic functions likemount
, the problem lies in the mapping between the source (vue
file) and output (compiled viavue-jest
into something Jest can read).Either way this is a very good reproduction, thank you!
I’ll move this issue to vue-jest, which I desperately need to find time to work on…
It’s out:
https://github.com/vuejs/vue-jest/releases/tag/v5.0.0-alpha.9