Jest hangs after first attempt of yarn test

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

This is output from cursor agent within the IDE:

Title: Jest tests hang indefinitely in integrated terminal, works fine in external terminal

Description:
Jest test suite runs successfully but the process never exits in Cursor’s integrated terminal. Same tests exit properly in macOS Terminal.app.

What I’ve tried (all failed):

  • –forceExit flag
  • –runInBand flag
  • process.exit(0) in globalTeardown
  • Spawning Jest as child process with forced exit
  • Setting TERM=xterm-256color
  • Clearing Jest cache
  • Proper cleanup of NestJS testing modules

Impact: Cannot run tests in Cursor’s terminal, must use external terminal.

Note: The process actually completes the tests (I can see the output), it just never exits. This suggests Cursor is preventing process termination, possibly by keeping file descriptors open or intercepting exit signals.

Steps to Reproduce

  1. Open Cursor
  2. Open integrated terminal (zsh)
  3. Run yarn test (or jest --runInBand --forceExit)
  4. Tests complete successfully but process hangs indefinitely
  5. Same command in macOS Terminal.app exits immediately after tests complete

Expected Behavior

I should be able to run
yarn test
which runs jest, multiple times, without force closing cursor completely.
it can run over and over again in the mac terminal, so I’m confused

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

  • OS: macOS (darwin 24.6.0)
  • Cursor version: [your version - Help > About]
  • Node version: v23.9.0
  • Jest version: 27.5.1
  • Shell: zsh

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

This is an interesting issue - tests complete but the process doesn’t release the terminal. Let’s diagnose:

Diagnostic info:

  1. What’s the exact Cursor version? (Help > About Cursor > Copy)
  2. Check Process Explorer: CMD+Shift+P > Developer: Open Process Explorer - look at ptyHost during Jest hang
  3. Try launching Cursor with extensions disabled: cursor --disable-extensions from terminal, then run yarn test - does the issue persist?

Possible fixes:

  1. Try creating a new terminal in Cursor after each test (temporary workaround)
  2. Check if it happens with other long-running processes (not just Jest) - e.g., try sleep 5 && echo "done"
  3. Does Ctrl+C kill the process or also hang?

If the issue persists after checking extensions, share the diagnostic results - I’ll pass to the team

Thanks so much for a speedy reply!
1.
Version: 2.1.50
VSCode Version: 1.105.1
Commit: 56f0a83df8e9eb48585fcc4858a9440db4cc7770
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 24.6.0

  1. It does fire up the tests process under /bin/zsh, but then still just hangs, until I press control + C

  2. OK, tried that, same issue.

Fixes,

  1. Yes, I tried this. Same
  2. That sleep test is fine, I can just keep running it, over and over.3.
  3. Control + C can kill the process, but then it will just hang again, until Cursor is totally restarted.

I really think it’s just got to be my machine right? No way anything is unique about my setup or test right now.
I also tried VS-Code, same issue. So I’m thinking, if it’s not VS-Code/Cursor related, it’s my machine. Weird that a regular mac terminal is fine though.

Anyway, thanks for looking. Just baffled.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.