-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcemap support when debugging (Intellij IDEA / Webstorm / others) #150
Comments
If there's a minimal repo that I could use to test this with WebStorm/IDEA, I could look into this much earlier than if I had to set a project up from scratch. It would also help me replicate your settings exactly if you include the |
Hi @kulshekhar, thanks for response. Here is a link to minimal test project: https://github.com/jugglingcats/ts-jest-idea |
Interesting, I tried that and it's not working for me. No breakpoint hit. |
I just noticed that you use the |
I'm using the debug button ;) Out of interest are you initiating the test run from the I am able to set a breakpoint in the It seems like when you run using the pre-processor it doesn't use the source maps in |
In my configuration, I set Jest to run on the entire project. I don't think (for the way I have set it up) it matters where debugging is initiated from. Here are the exact steps I took:
|
Ah, ok, that is working for you because you are matching both the When you are running the |
It appears to me that if there's a solution to what you want, it is likely somewhere in Webstorm's configuration/support and not ts-jest :) |
I tried a couple of things and got a strange behaviour:
The original I also removed Typescript Compile build step and deleted Now when I debug But when I debug The command line that IDEA is using is identical except the filename... very odd. I don't think this particular behaviour is a ts-jest issue but even if it were able to hit a breakpoint I don't think things will work correctly (see next comment) |
Back to sourcemaps... I added the pre-processor back in, and I've also added custom The following file is generated:
Note that I still haven't added Compile Typescript back in the run configuration (no To test this theory I generated the build files again, hacked the pre-processor output file and modified the path to be |
Sorry just saw your last comment. I think the sourcemap location issue is potentially fixable in ts-jest, assuming the facility is there for you to specify a relative path. Determining the correct relative path may not be trivial though. You would need the |
If this is the case, it'd be great to update ts-jest. I'd be happy to take a PR if you want to give it a shot 😄 |
Heheh I found your previous question to the Jest devs here: jestjs/jest#1474. That gave me a clue about inline sourcemaps, so I added This config setting causes the sourcemap to be emitted right into the target file using the It would be nice if ts-jest did this by default. I hacked the following into preprocessor.js and it seemed to do the trick: Not sure this is worthy of a pull request... :) |
@jugglingcats if that worked then setting that value in jest config should also work. Could you try that? |
@jugglingcats you're right! Setting I'm going to leave this open till I can add tests for this and set this value if it hasn't been explicitly set by the user. That should prevent others from facing this issue! |
Actually, it'll be better to track this is a new issue - #151 @jugglingcats is it fine if this issue were closed? |
It worked for me too. Example project and readme updated. Many thanks - we're done here. |
I'm just going to dig this up from the grave, as I seem to have an issue that's almost the same, but not quite. The inlinesourcemap work reasonably fine, but the only way I can get the debugger to do anything, is if i set an actual debugger; statement - breakpoints are simply ignored. Is this something any of you came across during your digging? my package.json's jest looks like this:
|
@GeeWee everything we did when we were working on this is mentioned here in this issue. If that doesn't help, the best thing would be to create a minimal repo that reproduces this and create a new issue |
Thanks @kulshekhar - it has been done - #209 |
I could not get my breakpoints to hit in Webstorm 2018.1.5 with ts-jest 22.4.0. I tried all of the above solutions, but it turns out it was because I was using node v7.10.1 I upgraded to node v8.9.4 and my breakpoints were instantly working. Hopefully this saves someone some struggle. |
@akos-sebestyen FYI:
You can see breaking changes of Jest there |
When debugging Jest tests in IDEA I set breakpoints but they are never triggered. I assume this is related to sourcemaps somehow.
Jest correctly gives Typescript filename+line when reporting errors / expect failures, so at this level sourcemaps are working.
This is more of a request for help than bug report. Do people have debugging fully working in your preferred IDE when running Jest tests?
For info, Jetbrains recently released integrated Jest support with progress bar, etc.
Here is the full command executed by IDEA:
tsconfig.js:
package.json:
The text was updated successfully, but these errors were encountered: