Debugging Jest unit tests hangs

I have experienced this issue since upgrading from 2017.3 to the latest 2018.1.5.  Running a jest test seems to work as expected, but when I switch to debug the same test, it hangs.  I have simplified this down to a project with a package.json and a single test file.  See screenshots below.  I click the green arrow on line 3, then select Debug 'testing', and it hangs in the state pictured below.

Here is my package.json

And here are the configuration settings for the test process

 

8 comments
Comment actions Permalink

I believe I have figured out the source of the issue, but it is appears to be a part of a larger issue... 

I had previously enabled the Registry flag

  js.debugger.break.on.first.statement.with.regexp 

because it is the recommended fix for an issue with React-native debugging:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000046264/comments/360000124730.

 

If I uncheck this flag, Jest will debug properly, but then my react-native debugging will still be broken.  Please advise.  Thank you!

4
Comment actions Permalink

I ran into a similar issue again today and thought I'd share my solution.  My jest tests started taking 1 minute or more before stopping on a break point.  I confirmed that the flag mentioned in the last comment was unchecked.  The solution was to

1. Quit webstorm

2. Open <project root>/.idea/workspace.xml (access via command line, or if using finder you may have to enable viewing hidden files).

3. Make a copy of that file in case you need to revert.

4. In workspace.xml, search for the <component name="XDebuggerManager"> tag.  I deleted the entire tag and its children, and saved over the file.

Upon opening your project, tests should debug a lot faster.  Guessing something in that xml got corrupted when upgrading my version of webstorm. 

Hope this helps!

3
Comment actions Permalink

Thank you koala koder, deleting the XDebuggerManager tag worked! I'm able now able to debug Jest Typescript files. Before, WebStorm would open the .js file and hang. Super frustrating.

0
Comment actions Permalink

For me, the first solution did the trick. The second didn't

0
Comment actions Permalink

For me neither of them resolved, it hangs forever

The message:

[IntelliJ is searching for port] Debugger listening on ***
For help see https://nodejs.org/en/docs/inspector
Debugger listening on ****
For help see https://nodejs.org/en/docs/inspector

And don't leave it

0
Comment actions Permalink

@Leonnardovalentino What Node.js version do you use? Please share a screenshot of your run configuration

0
Comment actions Permalink

Elena Pogorelova, the version of the Node.js is 8.9.3

Below, the screenshot

0
Comment actions Permalink

I see; Node.js version you are using is quite old, it is out of maintenance mode since 2019 according to https://github.com/nodejs/Release.. Please see https://www.jetbrains.com/help/webstorm/supported-node-js-versions.html for the list of interpreter version that are currently supported by us.

Please consider upgrading to Node 10.x or higher. As it's mentioned in Help, if any regressions or bugs associated with Node.js versions that are not maintained are identified in the current IDEA version, they will not be fixed:(

0

Please sign in to leave a comment.