-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
Malformed source URLs in source map cache on Windows #1769
Malformed source URLs in source map cache on Windows #1769
Comments
This is very likely to be caused by that
So I suggest we use either file URLs (PaperStrike@134bef2) or relative paths (PaperStrike@2a933ee). |
Thanks for this. It'll probably take me a few days before I can properly review, merge, and publish this. The push to prepare and publish 10.8.0 ahead of TS 4.7 was time-consuming, so I've had to switch gears this week and play catch-up on some other stuff. One thing that I want to make sure we get right: Node's stack traces from ESM files use file URLs, but from CommonJS files, they use native paths. I remember writing some logic to ensure that we preserve this behavior even after we've source-mapped the stack frames.
I want to be sure that, after we apply sourcemaps to a stack trace, the CJS files still use native paths, since that's the way vanilla node behaves. |
@cspotcode Thank you, I hadn't noticed the stack traces of different types of files, and hadn't considered the impact of the PRs on them. So just now I wrote a test case locally, and luckily found that neither #1770 nor #1771 affects the mapped stack traces. They all start with: Error: check the output traces
at createTraces (D:\PR\ts-node-bug-repro\commonjs.cts:2:15)
at file:https:///D:/PR/ts-node-bug-repro/esm.mts:3:1 Not posting code for this simple test so as not to waste everyone's time. |
Thanks, I will also check our existing tests. They may already be checking for this in some way, and I see both of your pull requests have passing tests on CI. |
I attempted the same test you did #1769 (comment) Since URLs in sourcemaps seems more correct/more sane/more robust than using basename, and since it doesn't seem to be breaking anything, I'm going to merge that one. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-node](https://typestrong.org/ts-node) ([source](https://github.com/TypeStrong/ts-node)) | devDependencies | patch | [`10.8.0` -> `10.8.1`](https://renovatebot.com/diffs/npm/ts-node/10.8.0/10.8.1) | --- ### Release Notes <details> <summary>TypeStrong/ts-node</summary> ### [`v10.8.1`](https://github.com/TypeStrong/ts-node/releases/tag/v10.8.1) [Compare Source](TypeStrong/ts-node@v10.8.0...v10.8.1) **Fixed** - Fixed [#​1769](TypeStrong/ts-node#1769): source URLs in source map cache were malformed on Windows, affecting code coverage reports ([#​1769](TypeStrong/ts-node#1769), [#​1771](TypeStrong/ts-node#1771)) [@​cspotcode](https://github.com/cspotcode) - Fixed [#​1778](TypeStrong/ts-node#1778): typechecker was erronously resolving imports from ESM files as if they were from CJS files ([#​1778](TypeStrong/ts-node#1778), [#​1782](TypeStrong/ts-node#1782)) [@​cspotcode](https://github.com/cspotcode) https://github.com/TypeStrong/ts-node/milestone/14 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: cabr2-bot <[email protected]> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1393 Co-authored-by: Calciumdibromid Bot <[email protected]> Co-committed-by: Calciumdibromid Bot <[email protected]>
@cspotcode Before we can test the impacts, could the file url/base name solution be made into an option? This problem is critical and easily reproducible when we use c8 with |
Search Terms
v8 coverage, coverage, source map windows
Expected Behavior
The
sources
field of the generated source map cache consists of file URLs (e.g.,file:https:///D:/Example/index.ts
).Actual Behavior
Some generated
sources
field contain malformed file paths (e.g.,d:/Example/index.ts
).I think it "malformed" because the disk letter, along with
:
, is treated like a protocol. At least, it should be in upper case. It will be better if it follows thefile:https:///
prefix like the others.Steps to reproduce the problem
NODE_V8_COVERAGE
.ts
file withts-node
sources
fields in each produced coverage output file with each other.Minimal reproduction
https://github.com/PaperStrike/ts-node-bug-repro
The workflow does basically the steps above, and prints the malformed URLs.
Specifications
The text was updated successfully, but these errors were encountered: