question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest tests won't complete properly when debugging

See original GitHub issue

Hi there, I gave the new debugger a quick try with my Jest tests to try parallel testing (no --runInBand) having noticed https://github.com/microsoft/vscode-js-debug/issues/214.

First thing I noticed is compared to a parallel run without the debugger speed seems very variable. Sometimes the tests don’t seem to finish at all… other times they take just a bit longer than a non-debug run.

Also even after a successful run Jest doesn’t close properly - last message on terminal is as below and still-active parent process needs to be stopped to finish debugging.

Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

I can’t share my project but tests use Puppeteer (automated web testing) so are quite heavy, maybe that is an issue? On the other hand, running tests in parallel without the debugger works fine on the command line.

My config is:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Tests (All)",
      "type": "node",
      "request": "launch",
      //"trace": true,
      "runtimeArgs": [
        //"--inspect-brk",
        "${workspaceRoot}/node_modules/.bin/jest",
        //"--runInBand",
        "--updateSnapshot",
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "port": 9229
    }
  ]
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
markm77commented, Feb 18, 2020

Thanks and no problem, I’ll keep observing things and open a new issue for anything else I see independent of the Node.js issue.

0reactions
connor4312commented, Feb 18, 2020

Okay, thanks. I brought this up in an issue under Node.js. Closing this here as it’ll be an upstream fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting
Tests are Failing and You Don't Know Why​. Try using the debugging support built into Node. Place a debugger; statement in any of...
Read more >
7 Ways to Debug Jest Tests in Terminal
1. The Standard Way · Go to a Chromium-based browser and open chrome://inspect . · Click “Open dedicated DevTools for Node” like in...
Read more >
How do you debug Jest Tests?
You can use Chrome DevTools to debug Jest tests. First, start Node debugger in your project:
Read more >
Troubleshooting · Jest
Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why #. Try using the debugging support built...
Read more >
Debugging with Jest and VS Code
Important note: If you don't see caught and uncaught exceptions listed under breakpoints, you can select vscode-jest-tests in the dropdown by RUN at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found