ckerr

#55443: test: isolate setPath() sessionData runs and report their timeouts

Merged
Created: Oct 28, 2026, 5:24:33 PM
Merged: Oct 29, 2026, 2:45:07 AM
5 comments
Target: main

Description of Change

The three app.setPath() > sessionData specs failed together on Windows CI. "writes to userData by default" hit the 30 s test timeout with none of the fixture app's output. Then the other two failed in beforeEach with EPERM removing the fixture's default userData directory.

They all ran the same fixture, so they shared its default userData directory (appData/<name>), and each removed it in beforeEach without retrying. When the first run timed out, the app's child processes outlived it and kept files there open.

  • Each spec now runs its own copy of the fixture under a name of its own, so it has its own default userData directory. The redirect specs write into the copy's directory, and no spec touches another's files.
  • Removing them is best effort: it keeps trying for 5 seconds, then logs the error and moves on. A beforeAll sweeps up leftovers from earlier runs, skipping anything from the last hour in case another run is still using it.

The timeout lost the app's output because spawnAndWait() waits for 'close'. That also waits for the child's stdout and stderr to close, and Windows testing builds hand both to their sandboxed child processes, so one that outlives the killed app keeps them open. Once spawnAndWait() has timed out, it now stops reading a second after the child exits. It then throws its usual timeout error with the output it has, and says when stdout or stderr stayed open. Runs that don't time out behave exactly as before.

The fixture also waited for the timeout when its page failed, when the page failed to load, when its renderer crashed, or on an uncaught exception. It now exits with the first such error, ignoring anything that follows from it or from quitting. It also logs each step as it starts, so a timeout shows how far it got.

Validation on Linux under Xvfb, with retries off. Linux can delete open files, so the Windows EPERM itself can't happen here. Throwaway controls stood in for it:

  • A detached process kept writing into the first spec's directory after its run was killed. On main, the other two specs failed at once, which is the same cascade. With this change they pass.
  • A hung fixture with a child process holding its inherited stdout and stderr. On main, that ended in the 30 s test timeout with no output, the recorded symptom. Now spawnAndWait() fails at 21 s with its own error and every step line.
  • A rejected service worker registration, a failed load, a renderer crash during and after the load, and an uncaught exception. Each one fails in well under a second, printing only its real cause.
  • The sessionData specs passed 10/10 runs, and other spawnAndWait() users (esm.spec.ts, and parts of node.spec.ts and api-protocol.spec.ts) still pass.

🤖 Generated with Claude Code

Checklist

Release Notes

Notes: none

Backports

44-x-y
Merged
PR Number
#55471
Merged At
Oct 29, 2026, 9:01:55 AM
Released In
Not yet
Release Date
Not yet
45-x-y
In-flight
PR Number
#55470
Waiting to be merged
46-x-y
Merged
PR Number
#55469
Merged At
Oct 29, 2026, 9:02:13 AM
Released In
v46.0.0-alpha.3
Release Date
Oct 29, 2026, 3:00:25 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