ckerr

#51441: fix: handle createWindow() rejection in import-meta test fixture

Merged
Created: May 1, 2026, 5:29:07 PM
Merged: May 4, 2026, 8:48:38 AM
4 comments
Target: main

Description of Change

Potential fix for an esm-spec.ts test flake in "should use import.meta callback handling from Node.js for Node.js modules".

The import-meta fixture's createWindow() is async but was called fire-and-forget. If loadFile() or executeJavaScript() rejects transiently, process.exit() is never reached. On macOS the process hangs indefinitely because 'window-all-closed' had a process.platform !== 'darwin' guard that skipped app.quit().

It's hard to prove that a test flake is fixed, but this theory matches the behavior and is worthwhile as a spec cleanup either way. edit: only a cleanup, unfortunately. The CI failure is still there.

Sample CI failure:

2026-05-01T20:20:27.6600380Z Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts)
2026-05-01T20:20:27.6603310Z     at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
2026-05-01T20:20:27.6605350Z     at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
2026-05-01T20:20:27.6607200Z Retrying test (1/3)...
2026-05-01T20:20:57.6695430Z Failure in test: "esm renderer process nodeIntegration without context isolation should use import.meta callback handling from Node.js for Node.js modules"
2026-05-01T20:20:57.6702120Z Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts)
2026-05-01T20:20:57.6704730Z     at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
2026-05-01T20:20:57.6706870Z     at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10)
2026-05-01T20:20:57.6708420Z Retrying test (2/3)...
2026-05-01T20:21:27.6770530Z Failure in test: "esm renderer process nodeIntegration without context isolation should use import.meta callback handling from Node.js for Node.js modules"
2026-05-01T20:21:27.6774450Z Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts)
2026-05-01T20:21:27.6777380Z     at createTimeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/errors.js:498:15)
2026-05-01T20:21:27.6779620Z     at Test.Runnable._timeoutError (/Users/runner/work/electron/electron/src/electron/spec/node_modules/mocha/lib/runnable.js:429:10) 
2026-05-01T20:21:27.6781470Z Retrying test (3/3)...
2026-05-01T20:21:57.6889880Z not ok 912 esm renderer process nodeIntegration without context isolation should use import.meta callback handling from Node.js for Node.js modules
2026-05-01T20:21:57.6893720Z   Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts)
2026-05-01T20:21:57.6896920Z   Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/electron/electron/src/electron/spec/esm-spec.ts)
2026-05-01T20:21:57.6899550Z       at listOnTimeout (node:internal/timers:605:17)
2026-05-01T20:21:57.6900560Z       at processTimers (node:internal/timers:541:7)
...
2026-05-01T21:06:04.6242770Z ##[error]The action 'Run Electron Tests' has timed out after 60 minutes.

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

Checklist

Release Notes

Notes: none.

Backports

40-x-y
Merged
PR Number
#51470
Merged At
May 5, 2026, 7:58:19 AM
Released In
v40.10.0
Release Date
May 8, 2026, 11:00:22 AM
41-x-y
Merged
PR Number
#51469
Merged At
May 4, 2026, 11:03:53 AM
Released In
v41.5.1
Release Date
May 8, 2026, 11:00:22 AM
42-x-y
Merged
PR Number
#51468
Merged At
May 4, 2026, 2:28:59 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