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
git clone https://github.com/sobanieca/ts-jest-sourcemaps-issue
npm i
npm run debug
Open in chrome chrome://inspect and connect debugger. There will be first initial breakpoint, click continue and proceed to the actual breakpoint from test.ts file.
Expected behavior
I would like to see proper source code (Typescript file), not some compiled version of it.
Actual behavior
In debugger I can see compiled JS code, which makes debugging harder.
I believe this is related to source maps file path mismatch. In sample repository, I've created ts-node project which properly displays code when debugging in Chrome. Comparing produced source maps we can see mismatch between file path and sources. For instance:
and in source map:
While for sample ts-express it's:
and in source map:
Ideally, I would love ts-jest to produce similar source maps as ts-node as in ts-express example in https://github.com/sobanieca/ts-jest-sourcemaps-issue. So instead of full path in sources like /home/... just produce test.ts.
Environment
System:
OS: Windows 11 10.0.22631
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Binaries:
Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.14.0 - C:\Program Files\nodejs\pnpm.CMD
But I've tried on Android (proot-distro Debian 12) and Linux (Debian 12 under WSL in Windows). Attached jest-ts log is from Android.
The text was updated successfully, but these errors were encountered:
Version
29.1.1
Steps to reproduce
Open in chrome
chrome://inspect
and connect debugger. There will be first initial breakpoint, click continue and proceed to the actual breakpoint fromtest.ts
file.Expected behavior
I would like to see proper source code (Typescript file), not some compiled version of it.
Actual behavior
In debugger I can see compiled JS code, which makes debugging harder.
Debug log
https://github.com/sobanieca/ts-jest-sourcemaps-issue/blob/main/ts-jest.log
Additional context
I believe this is related to source maps file path mismatch. In sample repository, I've created
ts-node
project which properly displays code when debugging in Chrome. Comparing produced source maps we can see mismatch between file path and sources. For instance:and in source map:
While for sample
ts-express
it's:and in source map:
I've seen in sourcemap v3 specification (https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1) that it's not very accurate about how to specify paths, especially for files. But I believe ts-jest should not put full path in
sources
part. There are some related open issues in sourcemaps rfc: tc39/ecma426#44.Ideally, I would love ts-jest to produce similar source maps as
ts-node
as ints-express
example in https://github.com/sobanieca/ts-jest-sourcemaps-issue. So instead of full path insources
like/home/...
just producetest.ts
.Environment
The text was updated successfully, but these errors were encountered: