(timeoutMs = READY_TIMEOUT_MS)
| 168 | } |
| 169 | |
| 170 | async function waitForAliceReady(timeoutMs = READY_TIMEOUT_MS): Promise<void> { |
| 171 | const deadline = Date.now() + timeoutMs |
| 172 | while (Date.now() < deadline) { |
| 173 | try { |
| 174 | // 5xx still means the app is reachable; only transport errors mean not-ready. |
| 175 | const res = await fetchAliceWebRequest(new Request('app://openalice/api/version'), alice, 1_000) |
| 176 | if (res.status < 500) return |
| 177 | } catch { |
| 178 | // child not listening on its IPC web transport yet |
| 179 | } |
| 180 | await new Promise((r) => setTimeout(r, 200)) |
| 181 | } |
| 182 | throw new Error(`Alice did not become ready over Electron IPC within ${timeoutMs}ms`) |
| 183 | } |
| 184 | |
| 185 | async function waitForUTA(utaUrl: string, timeoutMs = UTA_READY_TIMEOUT_MS): Promise<boolean> { |
| 186 | const deadline = Date.now() + timeoutMs |
no test coverage detected