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
[BUG] Incorrect code coverage when converting from V8 to istanbul #216
Comments
This was referenced Jan 18, 2024
6 tasks
@cenfun could you fix this to |
@AriPerkkio Sorry, I can't fix it, It's very complicated, any changes could break its function. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Bug description
I have a project where I'm using monocart-reporter to produce a code coverage report. The way my project is configured captures code coverage in V8 and then that is converted to
istanbul
.I'm not doing the conversation myself, I use some options on the
monocart-reporter
that when set use this packagev8-to-istanbul
to convert the V8 code coverage:When I enable these options the code coverage that I get is incorrect. Please see screenshots below for more information. The code coverage screenshots were produced by running with:
this shows correct code coverage
.toIstanbul
property set which defaults tofalse
:this shows correct code coverage
.toIstanbul
property set totrue
:this shows INCORRECT code coverage
.babel+istanbul
app/core/ui-services/ui-helper-functions.ts
app/features/find-institution/institutions-list/institutions-list.component.ts
v8 + monocart reporter without the toIstanbul property set which defaults to false
src/app/core/ui-services/ui-helper-functions.ts
src/app/features/find-institution/institutions-list/institutions-list.component.ts
v8 + monocart reporter with the toIstanbul property set to true
app/core/ui-services/ui-helper-functions.ts
app/features/find-institution/institutions-list/institutions-list.component.ts
How to reproduce
npm install
to install all the required packagesTo get the babel+istanbul code coverage:
npm run test-istanbul
. The first time tests will fail because of missing snapshots, you can ignore this.npm run nyc-report
.npm run open-istanbul-coverage
.To get the v8 + monocart reporter without the toIstanbul property set which defaults to false code coverage:
npm run test-monocart
. The first time tests will fail because of missing snapshots, you can ignore this.npm run open-monocart-coverage
.To get the v8 + monocart reporter with the toIstanbul property set to true code coverage:
npm run test-monocart
. The first time tests will fail because of missing snapshots, you can ignore this.npm run open-monocart-coverage
.More notes
To clarify, the problem is that when using
toIstanbul
set to true the code coverage conversion marks some lines as covered when they should not be.I first opened this bug at [BUG] Incorrect code coverage when converting from V8 to istanbul cenfun/monocart-reporter#50. I was told that the
monocart-reporter
package uses this packagev8-to-istanbul
to do the conversion.I hope the instructions provided are enough to replicate the issue and debug it. I'm hoping that by following the instructions to run with v8 + monocart reporter without the toIstanbul property set which defaults to false, you can look at the V8 coverage file and then you would be able to provide that to the
v8-to-istanbul
package to debug the problem.Let me know if you need more information.
The text was updated successfully, but these errors were encountered: