vite-plugin-vue icon indicating copy to clipboard operation
vite-plugin-vue copied to clipboard

`<template>` line is shown as not covered if `v-if` used in component (4.6+, 5.0+)

Open TheJaredWilcurt opened this issue 1 year ago • 9 comments

Related plugins

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.

template-coverage

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

  1. clone repo
  2. npm install
  3. npm t

System Info

Tested on Node 20 and 21, Ubuntu 22.04 LTS and also GHA.

Used Package Manager

npm

Logs

No response

Validations

TheJaredWilcurt avatar Mar 14 '24 22:03 TheJaredWilcurt

https://github.com/vitejs/vite-plugin-vue/compare/plugin-vue%404.5.2...plugin-vue%404.6.0

TheJaredWilcurt avatar Mar 15 '24 16:03 TheJaredWilcurt

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

TheJaredWilcurt avatar Aug 18 '24 17:08 TheJaredWilcurt