Closed azamat-sharapov closed 6 months ago
Not sure where the issue is, feel free to provide reproduction steps.
Guessing, if there is no sourcemap for the entry file, sourceFilter
will not be called.
I forgot to mention, this is only happening with remote URL, such as https://my-test-website.example.com. Cannot reproduce it with localhost servers.
Here is one sample file from my build: https://pr-641.z8999f743.rustrocks.me/assets/Tel-iIzw_ewH.js and it has sourcemap as well: https://pr-641.z8999f743.rustrocks.me/assets/Tel-iIzw_ewH.js.map
Again, this was working in monocart-reporter version 2.2.2 but stopped working with 2.4.4.
let me check with your js and map
It unable to find a method to reproduce the issue, because the single js your provided can not run independently. Could you please provide a small repo for the reproduction? thanks.
It seems that your sourcemap is strange, there is only one mapping.
@cenfun I have standard Vite setup, which you can inspect here (same repo I provided earlier for another issue).
I get two files, is it correct? What do you expect?
@cenfun I showed you the repository just to check overall setup (Vite, playwright config). Because this is small version of what we have in private repository. Let's summarise this issue:
sourceFilter
function is not triggeredsourceFilter
is important, because without it, I get bunch of unnecessary .js
files in coverage report, but I want to filter for .vue
files onlyOK, I understand. Could you please tell me how to set up a remote host to reproduce the issue? I need to debug the code to locate the issue. Or is there anything else that can help fix this issue?
@cenfun remote would be to make a build and host it somewhere. Then run e2e test agains that remote domain. This might be little more work to do, that's why I was trying to find which version introduced this issue. I can confirm that it started happening from monocart-reporter version 2.3.3
. It is working fine with version 2.3.2.
Yes, the issue should be caused by latest version monocart-coverage-reports
So there are lots of changes.
Could you please help to check the logs if any errors found in console with logging=debug
?
[
'monocart-reporter',
{
logging: "debug",
title: 'Web App test report',
coverage: {
logging: "debug",
},
},
],
@cenfun yeah, that's why I used pnpm's override functionality to override monocart-coverage-reports version and it worked fine with v2.5.6. (it starts breaking from v2.5.7).
So, monocart-reporter latest version (2.4.5) and monocart-coverage-reports older version (2.5.6) works together. However, I see some uncovered lines in coverage report, so I guess it's not good idea to mix those versions of libraries.
I will revert to latest versions of both libs and try with logging and let you know.
it starts breaking from v2.5.7
Good to know it.
I checked the changes and found there is a change for loading the soucemap file may caused the issue.
But still need a case to reproduce the issue. Is it works for following sourcemap?
https://pr-641.z8999f743.rustrocks.me/assets/Tel-iIzw_ewH.js.map
@cenfun I tried debugging, no errors. The version 2.5.6 works with Tel.vue file, yes:
@azamat-sharapov I just release a new version monocart-coverage-reports@2.7.5, please try it and let me know if fix the issue?
By checking your soucemap file, its content type is not json, so it may caused the issue
The right json content type should be Content-Type: application/json; charset=utf-8
You might need to set the content type to json for all .map files on your server.
@cenfun this is working now 🎉 thanks a lot! I've deployed a change to adjust content type as well 👍🏻
@cenfun unfortunately this is happening again (from version 2.7.6), sourceFilter function is not triggered. This time it's locally as well, not remote server. Node.js version 18.17.1
.
Could you please try Node v18.19.1? https://nodejs.org/dist/v18.19.1/ or Node 20+
@cenfun thanks for fixing, it's working with latest version on monocart-reporter and sorry for late reply 🙏🏻
I just upgraded monocart-reporter from v2.2.2 to v2.4.4 and
coverage.sourceFilter
is not working anymore. I can see thatentryFilter
andsourcePath
functions are triggered, but notsourceFilter
. Is there something obvious I should check? or should I start creating repro?