Version
v20.9.0
Platform
Microsoft Windows NT 10.0.22635.0 x64
Subsystem
module
What steps will reproduce the bug?
- Clone and install
git clone https://github.com/PaperStrike/node-c8-repro.git
cd node-c8-repro
npm ci
- Generate coverage json file on Windows
This will generate some malformed
sources like:
!["sources":["e:/PR/node-c8-repro/src/demo.ts"]](https://private-user-images.githubusercontent.com/22674396/279920535-476d2bdc-0617-47d1-bcfd-42eec8edaead.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzYyMDI0OTYsIm5iZiI6MTc3NjIwMjE5NiwicGF0aCI6Ii8yMjY3NDM5Ni8yNzk5MjA1MzUtNDc2ZDJiZGMtMDYxNy00N2QxLWJjZmQtNDJlZWM4ZWRhZWFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDE0VDIxMjk1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3YzMyZDgyZDM2Y2EzZWE0ZjkxZDk2NDA2ZTUzNmVlM2FjNjQ3MTgzNWRhYzZlOWE2NTdmMjE0YWQyNDNhYjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.v4svNrmsAu9TvIfUBE5AUKiJxey8aE99HzcjdSSW3ds)
- 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
- Manually modify the malformed path to file URL.
- 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
Version
v20.9.0
Platform
Microsoft Windows NT 10.0.22635.0 x64
Subsystem
module
What steps will reproduce the bug?
git clone https://github.com/PaperStrike/node-c8-repro.git cd node-c8-repro npm cisourceslike:--exclude-after-remapoption enabled.--exclude-after-remapnow 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
sourcesfield 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
if (path.isAbsolute(source)) return url.pathToFileURL(source).hrefprior to thereturninnode/lib/internal/source_map/source_map_cache.js
Lines 254 to 258 in a1693c6