monocart-reporter: [BUG] Inaccurate code coverage
Hi @cenfun,
When instrumenting playwright tests for an angular app using istanbul
via the babel-plugin-istanbul plugin
the code coverage shows accurately whilst when using V8 + monocart-reporter
some lines that should be covered show as uncovered even though there’s an indication those lines have been executed X number of times.
The images below show a part of the code coverage for a file which show the problem.
As per our conversation on Playwright
discord channel I’ve created a repo which allows you to easily reproduce the problem. Please see edumserrano/monocart-code-coverage-demo.
- Istanbul code coverage report:
- Monocart code coverage report:
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (9 by maintainers)
Commits related to this issue
- Apply fix from cenfun/monocart-reporter#29 — committed to edumserrano/monocart-code-coverage-demo by edumserrano a year ago
just removed the
webpack:///
see commit: https://github.com/cenfun/monocart-reporter/commit/1e9542cb945a72e95af4b3752148944fb38661ba I prefer to have it withoutwebpack:///
too.I understand that you spend a lot of time on the code coverage, so do I. But currently few users use this code coverage feature, suggestions are welcome. Thanks
confirmed it is a bug. the uncovered lines have not mered with covered lines some times. thanks for the example provided.
1.6.30
have released. please have a try.I can’t be sure if that change makes sense for all cases but I think it does at least for this scenario. I’d like to have it without
webpack
, I do think using thesourcePath
makes more sense but I’ll leave that up for you to decide.To help others, I’ll create a branch on the demo repo that contains the fix and update the README to mention the fix is on the branch:
1.6.29
playwright.config.ts
I think you can close this issue whenever you want @cenfun . Thank you for sorting this out and so quickly 🥇
no problem. actually, the
webpack:/xxx
is the url of the source file, and it will be converted to the path of the source file, If we don’t like url but prefer path, we can use path instead of url next time