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.

Coverage report incorrect

See original GitHub issue

I’ve been trying to get jest to work properly with a Vue 2 + Vite project. Jest reports pass/fail as I would expect, but the coverage report seems incorrect. Link to the repro here: https://github.com/qkjosh/vue-jest-coverage

package.json

"devDependencies": {
    "@babel/core": "7.18.5",
    "@babel/preset-env": "^7.18.2",
    "@vue/test-utils": "^1.2.2",
    "@vue/vue2-jest": "^28.0.0",
    "babel-jest": "28.1.1",
    "jest": "28.1.1",
    "jest-environment-jsdom": "28.1.1",
    "vite": "2.9.12",
    "vite-plugin-vue2": "^2.0.1"
  }

Given an incomplete test suite, the coverage report indicates 100% coverage and seems to treat the whole SFC component as one statement. Do I have something completely misconfigured, or is the coverage report broken?

image

image

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:12
  • Comments:29

github_iconTop GitHub Comments

6reactions
BenSheltoncommented, Jul 26, 2022

Using yarn we were able to fix this by locking both versions of @babel/core and @babel/generator to 7.17.9 (thanks to the suggestion from @udebella )

"devDependencies": {
  "@babel/core": "7.17.9"
},
"resolutions": {
  "@babel/generator": "7.17.9"
},

We only use babel for jest so this doesn’t have any other side effects for us, YMMV.

3reactions
xdubxcommented, Nov 29, 2022
"overrides": {
  "@babel/core": "7.17.9",
  "@babel/generator": "7.17.9",
  "istanbul-lib-instrument": "5.2.0"
}

works on vue3 too. thx @GrRivero @rklos

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code coverage report seems incorrect. Why? - Google Groups
The test code is: We can see that the method getUser has been tested and the getRecord.append statements have been covered. But sonar...
Read more >
Getting incorrect coverage report for no matter what module ...
We have a product with multiple python scripts which executes as different processes, sub-processes, daemons and on apache using mod-wsgi.
Read more >
Code coverage report shows incorrect class ... - YouTrack
Code coverage report shows incorrect class coverage percentage · Right click -> Run tests with coverage · Inspect coverage report · See class...
Read more >
Incorrect coverage number reported by codecov - Bug Fixes
The local jacoco report (screenshot below) shows about 85% coverage. The problem is codecov reporting only 20% while jacoco reports 85%. image.
Read more >
Incorrect coverage for Overall Code on feature branch
Issue summary: A feature branch containing small changes is not picking up the old code coverage for Overall Code.
Read more >

github_iconTop Related Medium Post

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