Skip to content

test_runner: fix wrong signal exit codes#62039

Open
edilson258 wants to merge 2 commits intonodejs:mainfrom
edilson258:fix/test-runner-signal-exit-codes
Open

test_runner: fix wrong signal exit codes#62039
edilson258 wants to merge 2 commits intonodejs:mainfrom
edilson258:fix/test-runner-signal-exit-codes

Conversation

@edilson258
Copy link

The test runner was exiting with a generic error code when interrupted by signals such as SIGINT, instead of using the standard signal-based exit codes.

This change ensures the runner returns the correct signal exit code (e.g., 130 for SIGINT) rather than 1.

Fixes: #62037

The test runner was exiting with a generic error code when interrupted
by signals such as SIGINT, instead of using the standard signal-based
exit codes.

This change ensures the runner returns the correct signal exit code
(e.g., 130 for SIGINT) rather than 1.

Fixes: nodejs#62037
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Feb 28, 2026
Comment on lines +288 to +289
process.removeListener('SIGINT', () => terminationHandler(kSigInt));
process.removeListener('SIGTERM', () => terminationHandler(kSigTerm));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't work as it is a different function than the the attached listener?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed and i think we can fix by creating a handler for each signal and use the same on signal attach and removal

@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.59%. Comparing base (76215dc) to head (2b411ee).
⚠️ Report is 69 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/harness.js 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62039      +/-   ##
==========================================
- Coverage   89.73%   89.59%   -0.14%     
==========================================
  Files         676      674       -2     
  Lines      206069   205463     -606     
  Branches    39517    39401     -116     
==========================================
- Hits       184909   184083     -826     
- Misses      13310    13586     +276     
+ Partials     7850     7794      -56     
Files with missing lines Coverage Δ
lib/internal/test_runner/harness.js 87.21% <90.00%> (+0.08%) ⬆️

... and 163 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. 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.

test_runner: use default signal exit codes when interrupted

3 participants