mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* test: run the spec suite with vitest Replace the in-process mocha runner with vitest driving a pool of Electron processes. - spec/vitest/electron-pool.ts is a vitest pool whose workers are 'electron spec/ --vitest-worker' browser processes talking to the CLI over a Node IPC channel (JSON, see ipc-serialization.ts, because the host Node cannot read Electron's newer V8 wire format). - spec/index.js keeps the pre-ready process setup and then hands the main process to vitest's worker runtime (spec/vitest/worker.ts). experimental.viteModuleRunner is off, so spec files are imported by Electron's own Node exactly as before (native ESM, type stripping, no Vite transform). - spec/vitest/mocha-compat.ts provides mocha's BDD globals (describe/it/ before/after, this.timeout()/this.skip(), done callbacks, resettable timeouts, hooks in declaration order, a macrotask between runnables) on top of vitest, so the spec files run unchanged. - Two projects run in sequence: everything not tagged 'serial' across several workers, then the 'serial' suites one file at a time. - script/spec-runner.js translates --files/-g into vitest filters, wraps the CLI in dbus_mock.py on Linux and reruns failures from vitest's JUnit report; leftover Electron processes are killed once per run (global-setup.js) and per worker process group. - spec-timings.json for shard balancing comes from timings-reporter.ts; mocha, its reporters and ELECTRON_FORCE_TEST_SUITE_EXIT are gone. * test: run the macOS app activation, hide and dock specs serially app.isActive(), app.hide()/show() and the dock are machine-wide state, so these suites cannot share the screen with other spec processes. The isActive spec also assumed the process starts out inactive, which a freshly launched worker on the CI hosts is not; hide first in that case.