Repository navigation
test: prepare the spec suite for a parallel runner (42-x-y) - #54285
Merged
Merged
Conversation
* test: use describe() for spec groups that were declared with it()
A few BrowserWindow spec groups were declared with it()/ifit() but only
contain further it() calls. Mocha registered the inner tests against a
suite that had already started, so they never ran; vitest rejects the
nesting outright. Declare them as suites.
Some of the tests this brings back to life no longer match macOS: a
non-resizable window is not maximizable there, and maximizable on its own
follows fullScreenable because the zoom button doubles as the full screen
button (NativeWindowMac::UpdateZoomButton), so those expectations are
updated or kept to Windows; representedFilename comes back as an absolute
path, so the spec sets one; and the animated setBounds()/setSize()
'resized' event does not arrive on the CI hosts, so that pair stays
skipped with a FIXME.
* test: set retries on the suite instead of inside the running test
this.retries(n) from inside a test body only works in mocha, which reads
the value after the attempt fails. Move the two remaining uses up to the
enclosing describe so the retry count is known when the test is
declared.
* test: keep running defer()-ed cleanups after one of them throws
runCleanupFunctions() stopped at the first cleanup that threw and never
cleared the list, so the same stale cleanup ran, and threw, again after
every later test in the file. Drain the list up front, run every entry,
and report the collected errors once.
* test: accept an options argument between the title and body of describe/it
Lets specs write it(title, { timeout, retry, tags }, fn) and
describe(title, { ... }, fn). timeout and retry map onto mocha's per
runnable settings; tags are ignored by the mocha runner and are there so
suites can be marked for the upcoming parallel runner without a second
syntax.
* test: only reap windows that were open when closeWindow() was called
closeWindow() checks on the next tick that no other windows were left
behind and destroys any it finds. It re-read the window list at that
point, so when the next test had already created its window by then, that
window was destroyed too and the test failed with 'Object has been
destroyed'. Whether that happened depended only on how long the runner
took between afterEach and the next beforeEach.
* test: don't count unrelated webContents in the WebContentsView reuse spec
The test compared getAllWebContents().length before and after, which also
counts webContents that earlier tests left to the garbage collector and
that can be collected while this test awaits a load. Compare the sets
instead.
* test: tag the suites that need the machine to themselves as serial
Suites that depend on OS-level window focus, the system clipboard, screen
capture, global shortcuts, real mouse input or the mocked D-Bus services
cannot share the machine with other test windows. Mark them with
{ tags: ['serial'] } so a parallel runner can hold them back and run them
one at a time; the mocha runner ignores the option.
* test: don't pick up another window's visibilitychange message
The document.visibilityState specs listened for 'pong' on ipcMain, so a
late message from the previous test's page (sent as its window was torn
down) could be taken for the first report of the new window. Listen on
the window's own webContents.ipc instead.
The BrowserView variant counted visibilitychange events from page load,
which includes the freshly shown host window becoming visible when that
reaches the renderer after the load; wait for the page to report
'visible' before counting.
* test: clear the logind mock's call log before the powerMonitor specs
The specs assert exact Inhibit call counts on the python-dbusmock logind
object. That mock is started once around the whole test run, so any other
Electron process of the same run that engaged powerMonitor has already
left calls in its log. Clear it before counting.
* test: wait for focus before blurring in the BrowserWindow.focus() spec
'focuses a blurred window' called blur() straight after show(). blur()
does nothing to a window that has not become key yet, and for the first
window a process shows on macOS that trails the 'show' event, so the
'blur' the test then waited for never came. Wait for 'focus' first, as
the BrowserWindow.blur() spec next to it already does.
* test: give the utilityProcess heap snapshot spec a minute
Growing the heap to its limit and writing the snapshot is CPU bound and
does not fit in the default 30 seconds on the macOS x64 CI hosts when
other spec files run alongside it.
(cherry picked from commit 5c34ec5)
codebytere
approved these changes
Sep 24, 2026
|
No Release Notes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #54261
See that PR for details. The BaseWindow spec and the windowStatePersistence, disableWakeLocks and unresponsive-event suites do not exist on this branch, so their parts are dropped; the clipboard suite keeps its Windows-on-Arm guard.
Notes: none