-
Notifications
You must be signed in to change notification settings - Fork 490
The recommended debug launch configuration for jest doesn't work with react-scripts-ts OR How to debug jest tests? #276
Comments
Well, it does work in general - I've just tested it with a freshly generated project on my linux system. |
Hmm, based on the issue you linked it seems to match the CRA docs I referenced. Assuming we have the same launch configuration and yours works and mine doesn't maybe I have different versions that are constructing different debug commands? I know VScode tries to do some smart stuff by detecting node versions and things. What versions are you on? I have:
|
The launch configuration does not even mention the The above worked fine on my linux machine, I'll have a look at this on my windows host tomorrow to see what happens there. |
This part is specificed as: Somehow it's using both Usually VSCode prints out orange text saying "detected node version X.... and using Y protocol" but I don't see that here. |
Also, the manual
Do you have screen shot of what the whole command is when it's generated via your launch config? |
Just tested this configuration on my windows (10) machine - it ends up with using
Checked on:
Just not that I've updated So the only main difference seems to be that you are using a quite old version of |
Well I'm at least a step closer, but still not able to hit breakpoints. I updated VSCode to I also tried using the I even tried a fresh new project with Jest just runs and says test passes without pausing execution. Only remaining different is node. I'm surprised I'm the only one with issues here given how recent the version requirements are just to debug. Perhaps everyone else is on linux. Anyways, thanks for taking your time to test this stuff on different systems for me. |
* Update to react-scripts-ts@2.13.0 based on issue: wmonk/create-react-app-typescript#276 (comment) * Add test debugging
It's not that recent - the current LTS is node 8.10, with 9.8 being the most recent version. 8.2 is quite old and was never intended as LTS. If you can set breakpoints, but not debug them, it also might have something to do with the |
Ah yea, I meant the other versions, not node. I'm still at loss. Here's what I tried for minimal reproduction of issue: Updated to node 8.10.0
(Same as here but change
Expected: Output:
Minimal repo with changes above applied to default CRA: |
I'm afraid I cannot reproduce this. Using the project above, I was able to debug without any problems (VSCode 1.21). |
I think there's also some weirdness with how Jest works in general. It's like I've had to run a test first before I can even add a debugger, lest VS Code complains it cannot find the line in the source maps. |
Has there been any further discovery regarding this issue? I'm running into my breakpoints being ignored with the following
Using the following versions on MacOS High Sierra 10.13.5:
I would really appreciate any help in getting through this. |
@joelleibow
|
I'm trying to debug my jest tests by following instructions from the original create-react-app:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#debugging-tests-in-visual-studio-code
However, it seems react-scripts-ts are not accepting the command line arguments the launch config passes.
I also tried the other method:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#debugging-tests-in-chrome
but it has the same issue since it's essentially running the same command but through npm script instead of VScode launcher.
Seems VSCode is properly generating a port to debug node on; however, react-scripts isn't understanding the CLI arg and fails to run, thus there is timeout as the debugger can never attach to process since it was never started.
Is there an alternative launch config for debugging jest tests that works with react-scripts-ts?
Is there maybe some upstream change in react-scripts that would enable it work?
If there another method recommended for debugging jest tests with react-scripts-ts?
The text was updated successfully, but these errors were encountered: