ckerr

#54735: test: run spawned Electron apps with a timeout instead of spawnSync

Merged
Created: Oct 7, 2026, 4:32:04 PM
Merged: Oct 8, 2026, 6:27:04 PM
5 comments
Target: main

Description of Change

Run the Electron apps that specs start with spawnSync() through spawnAndWait() instead, with a timeout.

spawnSync() blocks the spec worker's event loop until the app exits.
If the app hangs, the test's own timeout can't fire either, so nothing fails or reports until the whole run is killed.
Most of these call sites also ignored the app's exit status.

spawnAndWait() with a 20 second timeout kills a hung app and fails the test with the app's output.
Each test now also checks that the app exits with code 0, which all of these fixtures do on success.

Changed tests:

  • node.spec.ts: "Can find a module using a package.json main field"
  • api-protocol.spec.ts: "throws for invalid scheme names", and the custom protocol code cache tests
  • api-app.spec.ts: the setPath() session data tests
  • modules.spec.ts: "can be required if electron.exe is renamed" (Windows only)

Only test code changes.

Validation

Ran on a local Linux testing build of main under Xvfb:

  • The 7 changed tests that run on Linux passed in each of 3 runs.
  • script/lint.js --js and tsc -p tsconfig.spec.json pass.

🤖 Generated with Claude Code

Checklist

Release Notes

Notes: none

Backports

42-x-y
Pending
Waiting for a manual backport
43-x-y
Pending
Waiting for a manual backport
44-x-y
Merged
PR Number
#54789
Merged At
Oct 8, 2026, 10:33:19 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#54788
Merged At
Oct 8, 2026, 10:33:16 PM
Released In
Not yet
Release Date
Not yet

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