(url: string)
| 16 | const TIMEOUT = 120_000; |
| 17 | |
| 18 | async 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 | |
| 34 | export default async function globalSetup() { |
| 35 | await Promise.all(URLS.map(waitForServer)); |
nothing calls this directly
no outgoing calls
no test coverage detected