question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code coverage seems to be collected incorrectly

See original GitHub issue

I am looking to upgrade several projects to Vue 3 and I am running into an interesting issue when collecting code coverage. For some reason, when switching to Vue 3, the code coverage statistics are incorrect, but the tests are running correctly. Below is a repository that minimally reproduces the issue I am running into. Also attached are a couple of screenshots that show the difference in coverage between Vue 2 and Vue 3.

https://github.com/sam-pastoriza/vue-3-coverage

With Vue 2, you get the following coverage in the repo. image With Vue 3, you get the following coverage, without changing the tests. image

A readme file in that repository details how I switch between Vue 2 and Vue 3.

A couple of notes on the structure of the project I am working with.

  • We use vue-class-component as a library. I don’t think this is causing the issue, but I could be wrong.
  • We are required to split up the components into separate .ts and .vue files.

Many thanks for the help. Hopefully this is the right place to post this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
lmiller1990commented, Apr 5, 2021

This is most likely a bug in vue-jest which isn’t handling source maps correctly - test utils just provides some basic functions like mount, the problem lies in the mapping between the source (vue file) and output (compiled via vue-jest into something Jest can read).

Either way this is a very good reproduction, thank you!

I’ll move this issue to vue-jest, which I desperately need to find time to work on…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code coverage seems to be collected incorrectly #329 - GitHub
I am looking to upgrade several projects to Vue 3 and I am running into an interesting issue when collecting code coverage.
Read more >
Troubleshooting Code Coverage - Visual Studio (Windows)
Learn how to resolve erroneous empty results messages when you expect Visual Studio to collect data for native and managed assemblies.
Read more >
XCode 13 Not reporting accurate te… | Apple Developer Forums
My solution: If you have flag "GCC_GENERATE_TEST_COVERAGE_FILES=YES" specified in xcodebuild arguments, remove it in XCode 13. It seems like this will extract ...
Read more >
Code Coverage Results are incomplete (again)
Can you confirm that code coverage can be collected for individual projects and that coverage is only lost if you try to run...
Read more >
User Story Shows Incorrect Code Coverage
When calculating the coverage of a user story in Copado you might unexpected results. The coverage for a class in the user story...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found