Skip to content

Conversation

@mcollina
Copy link
Member

@mcollina mcollina commented Feb 4, 2026

Summary

When the test runner process is killed with SIGINT (Ctrl+C), display which test was running at the time of interruption. This makes it easier to identify tests that hang or take too long.

Changes

  • Add test:interrupted event emitted when SIGINT is received
  • Add interrupted() method to TestsStream
  • Handle the event in both TAP and spec reporters
  • TAP outputs: # Interrupted while running: <test>
  • Spec outputs with yellow header and warning symbol
  • Use setImmediate to allow reporter stream to flush before exit

Behavior

  • With process isolation (default): shows the file path since the parent runner only knows about file-level tests
  • With --test-isolation=none: shows the actual test name and location

Example output (TAP)

TAP version 13
# Interrupted while running: never ending test at /path/to/test.js:6:1

Example output (spec)

Interrupted while running:
⚠ never ending test (test.js:6:1)

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Feb 4, 2026
When the test runner process is killed with SIGINT (Ctrl+C), display
which test was running at the time of interruption. This makes it
easier to identify tests that hang or take too long.

- Add `test:interrupted` event emitted when SIGINT is received
- Add `interrupted()` method to TestsStream
- Handle the event in both TAP and spec reporters
- TAP outputs: `# Interrupted while running: <test>`
- Spec outputs with yellow header and warning symbol
- Use setImmediate to allow reporter stream to flush before exit

With process isolation (default), shows the file path since the
parent runner only knows about file-level tests. With --test-isolation=none,
shows the actual test name.
@mcollina mcollina force-pushed the test-runner-show-interrupted-test branch from dbbd948 to ad00a26 Compare February 4, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants