Open RedYetiDev opened 3 hours ago
In v22.9.0, there is no difference in the output with/without --enable-source-maps
:
ℹ start of coverage report
ℹ --------------------------------------------------------------
ℹ file | line % | branch % | funcs % | uncovered lines
ℹ --------------------------------------------------------------
ℹ stdin.test.ts | 57.14 | 100.00 | 100.00 | 4-6
ℹ --------------------------------------------------------------
ℹ all files | 57.14 | 100.00 | 100.00 |
ℹ --------------------------------------------------------------
ℹ end of coverage report
Version
node-v23.0.0-nightly202409243c5ceff85f
Platform
Subsystem
test_runner
What steps will reproduce the bug?
The Node.js coverage reporter does not correctly handle source maps with a custom
sourcesContent
and--with-source-maps
.This example was taken from the
test-runner/coverage
fixture:Output
```cjs // stdin.test.ts var import_node_test = require("node:test"); (0, import_node_test.test)("ok", () => { }); //# sourceMappingURL=stdin.test.js.map ``` ```json { "version": 3, "sources": ["stdin.test.ts"], "sourcesContent": ["import { test } from 'node:test';\ntest('ok', () => {});\n\nfunction uncovered() {\n return 'uncovered';\n}\n\n"], "mappings": ";AAAA,uBAAqB;AAAA,IACrB,uBAAK,MAAM,MAAM;AAAC,CAAC;", "names": [] } ```node --test --experimental-test-coverage --enable-source-maps
withnode --test --experimental-test-coverage
How often does it reproduce? Is there a required condition?
Everytime
What is the expected behavior? Why is that the expected behavior?
Without
--enable-source-maps
:Which is the same as not suppy
What do you see instead?
Additional information
No response