mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
vitest's onTestFinished runs *after* afterEach (contrary to the earlier assumption), so defer() callbacks saw windows already destroyed by afterEach(closeAllWindows). And runCleanupFunctions didn't clear its queue on throw, so one bad defer cascaded into every subsequent test. - runCleanupFunctions now splices the queue before iterating and wraps each cleanup in try/catch, aggregating errors. - closeAllWindows runs runCleanupFunctions() first, so the 190+ existing afterEach(closeAllWindows) call sites get mocha's ordering (defers run, then windows close) without modification. setup.ts's onTestFinished remains as a fallback for tests that defer() without closeAllWindows. - cleanupWebContents guards against already-destroyed contents.