vite-plugin-vue
vite-plugin-vue copied to clipboard
`<template>` line is shown as not covered if `v-if` used in component (4.6+, 5.0+)
Related plugins
- [X] plugin-vue
- [ ] plugin-vue-jsx
Describe the bug
In 4.5.2 and below components with v-if would have 100% test coverage, now with 4.6.0 and above they will report the first line of the Vue component (<template>) as not being covered in tests.
I've made the min-repro as simple as possible, it boils down to this:
Example:
<template>
<div v-if="true"></div>
</template>
<script>
export default {
name: 'App'
};
</script>
import { shallowMount } from '@vue/test-utils';
import App from '../../src/App.vue';
describe('App.vue', () => {
test('Shallow mount', async () => {
const wrapper = shallowMount(App);
expect(true)
.toEqual(true);
});
});
Reproduction
https://github.com/TheJaredWilcurt/vite-plugin-vue-min-repro
Steps to reproduce
- clone repo
npm installnpm t
System Info
Tested on Node 20 and 21, Ubuntu 22.04 LTS and also GHA.
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
https://github.com/vitejs/vite-plugin-vue/compare/plugin-vue%404.5.2...plugin-vue%404.6.0
I made a new branch in the minrepro with today's date and the latest versions for all dependencies. Issue is still present:
- https://github.com/TheJaredWilcurt/vite-plugin-vue-min-repro/tree/2024-08-18