Skip to content

test_runner: use default signal exit codes when interrupted #62037

@edilson258

Description

@edilson258

When the Node.js test runner is interrupted (e.g., via SIGINT or SIGTERM), it currently exits with default (0) exit code instead of the standard signal-based exit codes.

Line: 321

const terminationHandler = async () => {
const runningTests = findRunningTests(root);
if (runningTests.length > 0) {
root.reporter.interrupted(runningTests);
// Allow the reporter stream to process the interrupted event
await new Promise((resolve) => setImmediate(resolve));
}
await exitHandler(true);
process.exit();
};

Because of this, parent processes (like CI pipelines, shell scripts, or task runners) cannot distinguish between a successful process exit and an intentional user interruption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions