Description
Vue version
3.4.3
Link to minimal reproduction
https://github.com/mheinzerling/vue_10366/tree/master (3.4.3)
https://github.com/mheinzerling/vue_10366/tree/3.4.2
Steps to reproduce
Checkout the repo above and switch between master and 3.4.2. I included the generated coverage report, so there is initially nothing to run.
What is expected?
Report in master (3.4.3) showing essentially the same coverage as in 3.4.2 branch.
What is actually happening?
While updating from vue 3.3 to 3.4 I lost 800 lines of code coverage. Further investigation showed, that this are in general only 4 specific vue SFC. All of them have a own test file and the 3.3 coverage result seems to be more reasonable. Bisecting the update, I finally found the 3.4.2 to 3.4.3 update step to cause the issue.
Running the matching test for one of my component gives a coverage of this component:
on 3.4.2 - 76.47% Statements 195/255 50% Branches 1/2 0% Functions 0/14 76.47% Lines 195/255
on 3.4.3 - 37.64% Statements 96/255 50% Branches 1/2 0% Functions 0/14 37.64% Lines 96/255
Essentially the whole script block and the beginning of the template has no coverage. After a certain point everything seems fine.
In 3 out of my 4 components the coverage is starting right after the v-model
of a <select>
which also has v-if
.
Moving the v-if
to the container is fixing the issue in my project. Template code like the below is causing the issue:
<any>
<select
v-if="condition"
v-model="model"
...
Rebuilding it do e.g. the following code fixes the issue and the coverage is correct again.
<any v-if="condition">
<select
v-model="model"
...
Interestingly, in my minimal examples the issue seems to be unrelated to the existence of a v-if and the coverage is already broken if I use a select with a v-model.
System Info
"vitest": "1.2.2",
"@vitest/coverage-v8": "1.2.2",
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Memory: 4.22 GB / 31.89 GB
Binaries:
Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 4.1.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 121.0.6167.185
Edge: Chromium (121.0.2277.128)
Internet Explorer: 11.0.19041.3636
Any additional comments?
No response