MCPcopy Create free account
hub / github.com/bvaughn/react-window / waitForServer

Function waitForServer

integrations/tests/global-setup.ts:18–32  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

16const TIMEOUT = 120_000;
17
18async function waitForServer(url: string) {
19 const deadline = Date.now() + TIMEOUT;
20 while (true) {
21 try {
22 const response = await fetch(url);
23 if (response.ok) return;
24 } catch {
25 // Not listening yet
26 }
27 if (Date.now() > deadline) {
28 throw new Error(`Timed out waiting for ${url}`);
29 }
30 await new Promise((resolve) => setTimeout(resolve, 250));
31 }
32}
33
34export default async function globalSetup() {
35 await Promise.all(URLS.map(waitForServer));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected