-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: fix incorect coverage reporting (fix #375) #655
Conversation
This reverts commit 25c7e18.
… (vitest-dev#584)" This reverts commit de33284.
✔️ Deploy Preview for vitest-dev ready! 🔨 Explore the source changes: 725cb58 🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/61f510615a70f20008030668 😎 Browse the preview: https://deploy-preview-655--vitest-dev.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it agains a local branch but playing around with my test files did not result in different coverage and there is one line always uncovered no matter what test I write to accomodate for covering that line.
@mitchelvanbever can you share a repo? |
Just tried with the example folder react-testing-lib and it shows the same behaviour. The other node project is private, but I can try it with another public repo I have |
This change fixed coverage for |
I feel really stupid 🙈 I think I just didn't configure the coverage properly yesterday when trying it out. I was too excited about it 😬 I tried again on the example dir, with the proper configuration and I can confirm to have the same result as you show. |
Epic, awesome work @Demivan! |
// This is a magic number. It corresponds to the amount of code | ||
// that we add in packages/vite-node/src/client.ts:114 (vm.runInThisContext) | ||
// TODO: Include our transformations in soucemaps | ||
const offset = 190 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later we should calculate this number based on the length of the arguments, but I am fine to have the magic number for now.
FYI, the introduction of
|
@cexbrayat Yeah, we have issue about this already #670. Not sure what is the best solution. Without |
This reverts #584 - runtime coverage is not reporting functions that are not used as not covered.
Added manual soucemap adjustments because Vitest is prepending code to every file.
Fixes #375