fix: use CI env var to detect test environment

Check for CI environment variable (set by GitHub Actions and most CI
systems) instead of VITEST to skip beforeunload handler registration
during automated tests.
This commit is contained in:
Gerkinfeltser
2026-02-19 11:10:42 -06:00
committed by Mateusz Tymek
parent 1ee91fcc2f
commit a7fa8c76a4

View File

@@ -78,8 +78,8 @@ export class WindowsProcess implements OpenCodeProcess {
}
// Register beforeunload handler for window close cleanup
// Skip in test environment to avoid interfering with test lifecycle
if (typeof window !== "undefined" && !process.env.VITEST) {
// Skip in CI/test environments to avoid interfering with test lifecycle
if (typeof window !== "undefined" && !process.env.CI) {
window.addEventListener("beforeunload", () => {
if (WindowsProcess.currentProcess?.pid) {
WindowsProcess.killProcessSync(WindowsProcess.currentProcess.pid);