-
Notifications
You must be signed in to change notification settings - Fork 292
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
ncc producing faulty source maps? #1011
Closed
tmillr opened this issue
Dec 2, 2022
· 1 comment
· Fixed by #1122 or TheJ-Erk400/tryhackme-badge-workflow#6 · May be fixed by openziti/ziti-webhook-action#23, YoutacRandS-VA/act#1 or YoutacRandS-VA/act#4
Closed
ncc producing faulty source maps? #1011
tmillr opened this issue
Dec 2, 2022
· 1 comment
· Fixed by #1122 or TheJ-Erk400/tryhackme-badge-workflow#6 · May be fixed by openziti/ziti-webhook-action#23, YoutacRandS-VA/act#1 or YoutacRandS-VA/act#4
Comments
🎉 This issue has been resolved in version 0.38.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Jun 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having to manually transform the output
.js.map
file after building because otherwise it does not work with c8. The generated.map
file has invalid file paths within it that cause c8 to not work correctly producing invalid coverage reports (regardless of the output report format). The faulty paths begin with something like../webpack://
(clearly an invalid filesystem path).Now, I was ultimately able to get my coverage reports working correctly after a couple days of constant debugging and headaches. The solution I came up with is to manually transform the
.map
file post-build/post-compile in order to fix the faulty file paths myself. The faulty paths appear in thesources
key of the.js.map
file. You can view my temporary fix here: https://github.com/tmillr/breaking-change/blob/c432a9474cf9f5ee4a47f9945583fbb5a9869683/scripts/fix-sourcemap-sources.js#L1-L13What I learned (I think), is that c8 uses these generated paths in the
sources
key of the.map
file in order to retrieve the actual (pre-compile) source content from the filesystem. So, when these filesystem paths are incorrect/malformed because they begin with../webpack://
, c8 will produce inaccurate/faulty coverage reports (in my case, in my tests, it was being reported (via c8) that the compiled file was never even loaded/run, even though it was, and to make matters even worse, c8 was not making it obvious that there was any kind of error).Context/Env
My project is a fairly standard and vanilla node project using only js (no typescript), the latest versions of all dependencies including ncc (i.e. v0.34.0), and only has a few dependencies. I'm not using any other bundlers or transpilers. Project is
"type": "module"
and uses es module syntax.I then
mv
all build outputs indist
, except for the emittedpackage.json
, to the project root.The text was updated successfully, but these errors were encountered: