-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Describe the bug
In the process of trying to debug why jest is not able to update inline sourcemaps for my project, I think I have found an swc bug where some given input code gets an incorrectly generated source map. See below!
Input code
export {};
describe("whatever", () => {
test("it can find inline snapshots", () => {
expect([1, 2]).toMatchInlineSnapshot(`
Array [
1,
2,
]
`);
});
test("it can find two inline snapshots", () => {
expect([3, 4]).toMatchInlineSnapshot();
});
});Config
{ "sourceMaps": "inline", "jsc": { "target": "es2020", "externalHelpers": true } }Playground link
Expected behavior
The sourcemap matches the input content, and doesn't have ranges in the output content with no source mapping at all. I find this is easiest to see with https://evanw.github.io/source-map-visualization/, here's a screenshot of the output file:
That shows how many of the lines in the output are mapped incorrectly unless I am missing something!
Version
1.2.112
Additional context
No response