mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
closeWindow's assertNotWindows path tried to assert 'this was the only window' one tick after closing, which only worked if the next-tick fired after the outer afterEach(closeAllWindows) — a race that mostly held under mocha and doesn't under vitest. Replace it with assertNoWindowsLeaked() registered as a setupFiles-level afterAll — it runs once per file after every test-file afterAll, so suites that share a window across tests (useRemoteContext, the api-context-bridge reuse, etc.) aren't flagged on every test. Verified ordering with probe files: a describe-level afterAll(closeWindow) runs before the global check, and a file that never cleans up is flagged. closeWindow is now a plain awaited close; the assertNotWindows option and its 7 call-site opt-outs are removed. useRemoteContext's afterAll now awaits 'closed' so the shared window is actually gone before the leak check fires.