ckerr

#51432: fix: don't let tests hang for an hour

Merged
Created: May 1, 2026, 11:13:04 AM
Merged: May 4, 2026, 8:46:39 AM
4 comments
Target: main

Description of Change

Fix two spec runner bugs that could cause tests to hang forever.

  1. Add a spawnAndWait() spec helper that ensures that spawned processes are cleaned up. When a caller-provided timeout is reached, the helper terminates the child process and escalates to SIGKILL if the process doesn't exit cleanly.

  2. In the "rerun failed tests" phase of script/spec-runner.js, enforce a timeout based on MOCHA_TIMEOUT.

Sample error CI log from here:

Rerunning failed test: esm renderer process nodeIntegration without context isolation should use import.meta callback handling from Node.js for Node.js modules (esm-spec.ts)
========================================
Running: /Users/runner/work/electron/electron/src/out/Default/Electron.app/Contents/MacOS/Electron electron/spec --enableRerun=3 --trace-uncaught true --enable-logging true --files /Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts -g esm renderer process nodeIntegration without context isolation should use import\.meta callback handling from Node\.js for Node\.js modules
2071

Error: The action 'Run Electron Tests' has timed out after 60 minutes.

Complements #51441. This PR is "try to fix the runner to not hang on a failed test", 514441 is "try to fix the test."

Checklist

Release Notes

Notes: none.

Backports

40-x-y
Pending
Waiting for a manual backport
41-x-y
Merged
PR Number
#51467
Merged At
May 4, 2026, 10:50:40 AM
Released In
v41.5.1
Release Date
May 8, 2026, 11:00:22 AM
42-x-y
Merged
PR Number
#51466
Merged At
May 4, 2026, 1:10:48 PM
Released In
v42.0.0
Release Date
May 5, 2026, 2:07:06 PM

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron