Files
arkvault/tests/e2e/support/global-setup.ts
T
2026-10-12 07:42:51 +09:00

16 lines
424 B
TypeScript

import { BASE_URL } from "./app.ts";
// Waits until the app is ready (e.g. migrations are done)
export default async function globalSetup() {
for (let i = 0; i < 120; i++) {
try {
const res = await fetch(`${BASE_URL}/auth/login`);
if (res.ok) return;
} catch {
// Not ready yet
}
await new Promise((resolve) => setTimeout(resolve, 500));
}
throw new Error("The app didn't start");
}