Skip to content
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

Absolute windows paths are not parsed correctly when generating source map cache #50523

Closed
PaperStrike opened this issue Nov 2, 2023 · 0 comments · Fixed by #50580
Closed
Labels
source maps Issues and PRs related to source map support.

Comments

@PaperStrike
Copy link
Contributor

PaperStrike commented Nov 2, 2023

Version

v20.9.0

Platform

Microsoft Windows NT 10.0.22635.0 x64

Subsystem

module

What steps will reproduce the bug?

  1. Clone and install
    git clone https://github.com/PaperStrike/node-c8-repro.git
    cd node-c8-repro
    npm ci
  2. Generate coverage json file on Windows
    npm run gen-coverage
    This will generate some malformed sources like:
    "sources":["e:/PR/node-c8-repro/src/demo.ts"]
  3. Verify that these malformed paths do affect some tools like using c8 with --exclude-after-remap option enabled.
    # this is c8 without --exclude-after-remap
    npm run report-coverage
    # this is c8 with --exclude-after-remap
    npm run report-coverage-failing
  4. Manually modify the malformed path to file URL.
  5. Verify that c8 --exclude-after-remap now works fine.

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

The generated source map sources field should contain absolute file URLs as the document stated.

What do you see instead?

The generated source map cache contains a malformed path and breaks third-party tools.

Additional information

PaperStrike added a commit to PaperStrike/node that referenced this issue Nov 6, 2023
We were incorrectly parsing windows drive letters as schemes. This was
polluting the source map cache with malformed file paths.

Fixes: nodejs#50523
@tniessen tniessen added the source maps Issues and PRs related to source map support. label Nov 24, 2023
nodejs-github-bot pushed a commit that referenced this issue Dec 5, 2023
We were incorrectly parsing windows drive letters as schemes. This was
polluting the source map cache with malformed file paths.

Fixes: #50523
PR-URL: #50580
Reviewed-By: Chengzhong Wu <[email protected]>
RafaelGSS pushed a commit that referenced this issue Dec 15, 2023
We were incorrectly parsing windows drive letters as schemes. This was
polluting the source map cache with malformed file paths.

Fixes: #50523
PR-URL: #50580
Reviewed-By: Chengzhong Wu <[email protected]>
richardlau pushed a commit that referenced this issue Mar 25, 2024
We were incorrectly parsing windows drive letters as schemes. This was
polluting the source map cache with malformed file paths.

Fixes: #50523
PR-URL: #50580
Reviewed-By: Chengzhong Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source maps Issues and PRs related to source map support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants