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

Wrong coverage lines due to missing template #500

Closed
meufel opened this issue Sep 16, 2022 · 3 comments
Closed

Wrong coverage lines due to missing template #500

meufel opened this issue Sep 16, 2022 · 3 comments

Comments

@meufel
Copy link

meufel commented Sep 16, 2022

Hey everyone,

first of all thanks for your work!

I'm facing a problem since the latest version of vue2-jest 29.1.0:

Problem Description

The coverage resulting from my tests does not contain the <template> part of my SFC-files.
This leads to

  1. wrong line numbers inside the cli text summary
  2. incomplete file representation inside the cobertura html report

Especially the 1) has a significant impact on my daily work writing tests.

SFC:
sfc

Text Summary:
text coverage

HTML Report:
html coverage

Reproduction

The following project shows the impact when running the tests: https://github.com/meufel/vue-jest-coverage-repro

Reseach Results

Looking at the changes coming with script setup support I noted that the related commit contains a snapshot, which also lost its template part (resp. its // representation).

Since I have to stick with v29.0.0 for now, is there an option to reenable the correct line number generation?

@meufel
Copy link
Author

meufel commented Jan 13, 2023

Resolved by #516. Thank You!

@meufel meufel closed this as completed Jan 13, 2023
@Rodigee
Copy link

Rodigee commented Jan 17, 2023

I'm still seeing a similar issue, even when on 29.2.2.

@meufel
Copy link
Author

meufel commented Jan 18, 2023

It may be a jest caching issue. I can reproduce the problem when only updating vue-jest but keeping the jest version:
npm install -D @vue/vue2-jest@29.2.2 && npm test

Running npm test -- --clearCache once fixes the coverage report.

Updating the jest dependency invalidates the cache. I did that too when updating vue-jest, so I didn't run into this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants