deepak1556

#54507: test: wait for child output before asserting on it

Merged
Created: Sep 28, 2026, 5:58:42 AM
Merged: Sep 28, 2026, 12:35:50 PM
4 comments
Target: main

Description of Change

Followup to #54410 (comment) on a general sweep for applicable sites.

Details
Site Test / helper What the child writes before exiting
api-app.spec.ts#L255 emits a process exit event with the code logs from process.on('exit')
api-app.spec.ts#L286 exits cleanly when called before ready right after loading tls checks that stderr has no crash message printed at exit
api-app.spec.ts#L310 exits with code 1 when no display is available checks that stderr has no Check failed printed at exit
api-app.spec.ts#L2096 getGPUInfo() API helper logs JSON, then setImmediate(app.exit)
api-context-bridge.spec.ts#L1758, #L1773 ContextBridgeMutability on / off logs console messages, then app.quit() on did-finish-load
api-debugger.spec.ts#L115 fires detach event for a webContents that is still attached at quit writes during shutdown
api-js2c-code-cache.spec.ts#L37 runFixtureApp writes the result line, then exits
api-menu.spec.ts#L1101 does not override null menu on startup logs, then app.quit()
api-protocol.spec.ts#L953 does not crash on exit checks that output has no error printed during shutdown
api-safe-storage.spec.ts#L177 can decrypt after closing and reopening app logs, then app.quit()
api-session.spec.ts#L350 should survive an app restart for persistent partition writes, then app.quit()
api-session.spec.ts#L622 shared dictionary APIs helper logs JSON, then app.quit()
api-utility-process.spec.ts#L644, #L658 supports redirecting stdout / stderr to parent process a utility process that inherited the pipe writes, then exits; 'close' also waits for its copy of the pipe
asar-integrity.spec.ts#L47 spawn helper logs alive / *-read-ok, then exits
chromium.spec.ts#L595 --lang switch helper writes, then app.quit()
chromium.spec.ts#L971, #L986 loads first party sets / loads sets from the command line writes, then app.quit()
cpp-heap.spec.ts#L1919 makes wrappers inert before shutdown cleanup regardless of registration order writes during shutdown
lib/msix-helpers.ts#L172 spawn helper app output the MSIX specs assert on
node.spec.ts#L419, #L436 does not log the warning more than once (unhandled and handled) error / warning output at exit
node.spec.ts#L956, #L988 throws with an invalid number / string argument console.log(err); process.exit(99)
node.spec.ts#L1171 Fails for options disallowed by Node.js itself prints the error, then exits with 9; the test failed if the line hadn't arrived by 'exit'
node.spec.ts#L1436 Supports starting the v8 inspector with --inspect and a provided port inspector line, then the script exits
node.spec.ts#L1455 Does not start the v8 inspector when --inspect is after a -- argument checks that output has no inspector line
node.spec.ts#L1593 does not crash when a wasiImport call is optimized writes ok, then process.exit(0)

utilityProcess: wait for the expected output itself. utilityProcess has
no 'close' event, and its output can still arrive after 'exit'. These now
resolve on the expected text, as the other utilityProcess specs already do:

Site Test
api-utility-process.spec.ts#L356 is launches an mjs file
modules.spec.ts#L101 require('electron/lol') should throw in the utility process

Intentionally left on 'exit':

  • lib/autoupdater-darwin-helpers.ts: the relaunched app inherits the pipe, so
    'close' would also wait for it to quit. These specs need to wait for their
    expected output instead; that's a separate change.
  • Sites that only print the output in a failure message
    (crash.spec.ts, api-browser-window.spec.ts, the encrypt step in
    api-safe-storage.spec.ts), and lib/codesign-helpers.ts, whose output no
    caller reads.
  • chromium.spec.ts remote-debugging tests: these apps keep running, so
    'exit' before the DevTools line can only mean a crash.

Release Notes

Notes: none

Backports

43-x-y
Pending
Waiting for a manual backport
44-x-y
Pending
Waiting for a manual backport
45-x-y
Pending
Waiting for a manual backport

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