-
Notifications
You must be signed in to change notification settings - Fork 10
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] Inaccurate code coverage #29
Comments
It should be fixed, please try new version monocart-reporter@1.6.29 The root cause is that the original location cannot be found from the sourcemap sometimes. Sourcemap matching is always a problem, especially when some non-native js syntax is used. we can find out the mismatch with tool: https://evanw.github.io/source-map-visualization/ It seems that sourcemap related issues should be traced back to compilation tools like babel. Thanks for such a detailed description of the problem, more suggestions are welcome. |
Something didn't quite work for me. I updated If I rollback to Any thoughts? |
Awesome! All is working 🎉 and you made it even better by not having the I do have a follow up question. In the coverage details fly out could we also remove the I'd assume it would be related with the fix you did to remove |
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 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:
I think you can close this issue whenever you want @cenfun . Thank you for sorting this out and so quickly 🥇 |
just removed the I understand that you spend a lot of time on the code coverage, so do I. |
This might be a stupid question but the change you mentioned from commit 1e9542c will be in a new version right? |
yes, |
|
I can confirm version |
@cenfun found some more examples where code coverage from I've had to expand the code of the demo repo and created a branch named Following again the instructions on the README:
You can see a difference in for instance:
In both of the above files, the V8+monocart-reporter find-institution.view-model.tsThe return statement that shows as uncovered should show as covered. V8+monocart-reporter recently-used-institutions.service.tsThe Another example that shows incorrect coverage is on an Both of the above red lines should show as covered. And, similarly to the original bug reported on this issue, notice that one of the lines that shows as uncovered has the indication that it has been executed
|
Let's check if v8 coverage is correct in dist file first
thoughts
|
Thank you for looking into this. If it helps, on that Let me know if there's anything I can help with. |
confirmed it is a bug. the uncovered lines have not mered with covered lines some times. thanks for the example provided. |
It's so hard to find the root cause. await Promise.all([
page.coverage.startJSCoverage({
resetOnNavigation: false
}),
page.coverage.startCSSCoverage({
resetOnNavigation: false
}),
]); This is because if there are multiple pages in one test, the coverage data will be reset if navigation happened test(`recently used @find-institution @recently-used`, async ({ page }) => {
const findInstitutionPage = new FindInstitutionPage(page);
const chooseSignInPage = new ChooseSignInPage(page); |
And the issues with the You were right, after upgrading to await Promise.all([
page.coverage.startJSCoverage({
resetOnNavigation: false
}),
page.coverage.startCSSCoverage({
resetOnNavigation: false
}),
]); Awesome work once again @cenfun 🙏 Feel free to close this issue. |
Hi @cenfun,
When instrumenting playwright tests for an angular app using
istanbul
via thebabel-plugin-istanbul plugin
the code coverage shows accurately whilst when usingV8 + 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.The text was updated successfully, but these errors were encountered: