Ts-jest: v23 breaks WebStorm breakpoints

Created on 19 Jul 2018  Â·  14Comments  Â·  Source: kulshekhar/ts-jest

Issue

v23 breaks WebStorm's ability to set and hit breakpoints.

Expected behavior

Tests should remain debuggable after upgrading to v23.

Output from your debug log

Not created. I set the environment variable TS_JEST_DEBUG="true", but neither the WebStorm run nor the console run (TS_JEST_DEBUG="true" yarn test) create a file at ./node_modules/ts-jest/debug.txt**.

Link to a minimal repo that reproduces this issue

https://github.com/Y0hy0h/ts-jest-debug

Instructions are in the repo's README.

Additional Info

Obviously, this is a breaking change in v23 and it could be considered noting it in issue #601.

Bug

Most helpful comment

tested, #626 will fix this (tho you NEED to remove the --watchAll option from the run configuration for it to work, even in 22.x – but yeah, it's broken in actual 23.0.1)

All 14 comments

I was struggling with this problem yesterday. Thank you for reporting this issue!

tested, #626 will fix this (tho you NEED to remove the --watchAll option from the run configuration for it to work, even in 22.x – but yeah, it's broken in actual 23.0.1)

fixed in 23.1.2

I think can not close this issue, use [email protected] and [email protected] breakpoint still not hit, use [email protected] is work

Hi @nodece, thanks for the feedback.
Can you provide the link to a minimal repo where we can reproduce the issue, it'll help us fix it.

hmmm. I've tested that one with the repo provided by @Y0hy0h, just testing again now and it doesn't work... weird. @nodece no need for a minimal repo!

Ok, good I waited to post this comment. If you add @babel/core, then it'll work with breakpoints. If you cannot, or don't wan't to add it and still use the v6, then you can add debugger as a workaround. I guess it has something to do with how babel is handling source-map depending on the versions. So I wouldn't say that it directly depends on ts-jest version, but on the babel version used under the hood. I'll take a look as soon as I have a bit of time today.

@Y0hy0h Thanks.

btw @Y0hy0h you used roots in jest. This is used to define multiple PROJECTs, so you should use "rootDir": "../src", and define mapping accordingly instead

UPD: sorry I am wrong, I mistaken with the projects option

@huafu But generally, if you'd like to have anything changed in the repo, just submit a PR. ;)

Oh man now re-installing everything and clearing all caches I know of it DOES work!....

oooohhh OK found it

this is a babel issue, the fix is: https://github.com/babel/babel/commit/21fdaa2a046bb76704992d21c38b089d4a292dc8

...now looking at what can be done ts-jest's side

Use typescript,not use babel, why is the v22.4.6 version available? @huafu

ts-jest uses babel under the hood for hoisting and also instrumentation. You can look in the git history of babel to find out why it was working in v22, sorry I have no time for this now. I guess jest was adding the sourcemap comment itself in 22...

Now working on a fix (which will be a hack) so that we can continue to use babel 6 with breakpoints...

🎉

screen shot 2018-08-05 at 17 22 29

Was this page helpful?
0 / 5 - 0 ratings