You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add "mapRoot": "./src", to tsconfig.json (any relative path will do),
TypeScript generated file sourceMappingURL will be a relative path, not a file name in this case: //# sourceMappingURL=../../src/app/app.component.spec.js.map
the updateOutput function expects the path to be just a file name
, so the code updated by ts-jest looks like: //sourceMappingURL=../../src/app/data:application/json;charset=utf-8;base64,...,
the malformed sourceMappingURL causes Jest to ignore it and to map errors and coverage incorrectly.
Expected behavior
The updateOutput function should expect the path to be a relative path, not always a file name.
Link to repo (highly encouraged)
The issue can be reproduced in any repo by adding the mapRoot setting and either inspecting generated code, or producing any error in the sample repo and observing incorrect line reporting by Jest.
🐛 Bug Report
The
mapRoot
setting breaks source map URL generation.To Reproduce
Steps to reproduce the behavior:
"mapRoot": "./src",
totsconfig.json
(any relative path will do),sourceMappingURL
will be a relative path, not a file name in this case://# sourceMappingURL=../../src/app/app.component.spec.js.map
updateOutput
function expects the path to be just a file namets-jest/src/compiler/instance.ts
Lines 25 to 26 in 5e957c7
ts-jest
looks like://sourceMappingURL=../../src/app/data:application/json;charset=utf-8;base64,...
,sourceMappingURL
causes Jest to ignore it and to map errors and coverage incorrectly.Expected behavior
The
updateOutput
function should expect the path to be a relative path, not always a file name.Link to repo (highly encouraged)
The issue can be reproduced in any repo by adding the
mapRoot
setting and either inspecting generated code, or producing any error in the sample repo and observing incorrect line reporting by Jest.This sample repo may be used: https://github.com/ArtemGovorov/wallaby-2434.
Running
npx jest
in the repo's root produces wrong error report (lines are not mapped) because of the issue described above:The text was updated successfully, but these errors were encountered: