Skip to content
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

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

Open
8 of 9 tasks
TheJaredWilcurt opened this issue Mar 14, 2024 · 2 comments
Open
8 of 9 tasks
Labels
bug Something isn't working

Comments

@TheJaredWilcurt
Copy link

TheJaredWilcurt commented Mar 14, 2024

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

@haoqunjiang haoqunjiang added bug Something isn't working and removed pending triage labels Mar 15, 2024
@TheJaredWilcurt
Copy link
Author

@TheJaredWilcurt TheJaredWilcurt changed the title <template> line is shown as not covered if v-if used in component (4.6+) <template> line is shown as not covered if v-if used in component (4.6+, 5.x+) May 19, 2024
@TheJaredWilcurt TheJaredWilcurt changed the title <template> line is shown as not covered if v-if used in component (4.6+, 5.x+) <template> line is shown as not covered if v-if used in component (4.6+, 5.0+) May 19, 2024
@TheJaredWilcurt
Copy link
Author

I made a new branch in the minrepro with today's date and the latest versions for all dependencies. Issue is still present:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants