Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(test): update test setup file

Steven Enamakel95b765e71b9c
diff --git a/app/src/test/setup.ts b/app/src/test/setup.ts
index 6704e69971..3281721aca 100644
--- a/app/src/test/setup.ts
+++ b/app/src/test/setup.ts
@@ -212,9 +212,11 @@ if (typeof globalThis.PointerEvent === 'undefined') {
// regress to the non-Tauri path. Seed a no-op handle once globally so the
// IPC-readiness check passes by default. Tests that *want* the CEF gap
// behaviour can `delete window.__TAURI_INTERNALS__` in a `beforeEach`.
-(
- window as unknown as { __TAURI_INTERNALS__: { invoke: () => Promise<unknown> } }
-).__TAURI_INTERNALS__ = { invoke: vi.fn(() => Promise.resolve()) };
+if (typeof window !== 'undefined') {
+ (
+ window as unknown as { __TAURI_INTERNALS__: { invoke: () => Promise<unknown> } }
+ ).__TAURI_INTERNALS__ = { invoke: vi.fn(() => Promise.resolve()) };
+}
// Mock Tauri APIs (not available in test env)
vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn(), isTauri: vi.fn(() => false) }));
@@ -417,9 +419,11 @@ afterEach(async () => {
// (e.g. tests exercising the CEF-gap branch of `isTauri()`). Without
// this, sibling tests in the same jsdom worker would silently regress
// to the non-Tauri path. Per graycyrus review on PR #1556.
- (
- window as unknown as { __TAURI_INTERNALS__: { invoke: () => Promise<unknown> } }
- ).__TAURI_INTERNALS__ = { invoke: vi.fn(() => Promise.resolve()) };
+ if (typeof window !== 'undefined') {
+ (
+ window as unknown as { __TAURI_INTERNALS__: { invoke: () => Promise<unknown> } }
+ ).__TAURI_INTERNALS__ = { invoke: vi.fn(() => Promise.resolve()) };
+ }
});
afterAll(async () => {
await stopMockServer();