Skip to content

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

Closed
@PaperStrike

Description

@PaperStrike

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source mapsIssues and PRs related to source map support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions