Files
electron/script
Samuel Attard 32b93bf499 test: run the spec suite with vitest (#54264)
* 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.
2026-09-25 17:20:37 -07:00
..
2025-05-30 10:59:11 +02:00
2026-03-18 19:14:49 -04:00
2024-03-21 09:48:23 -04:00
2026-09-21 13:09:46 -07:00