()
| 183 | } |
| 184 | |
| 185 | async function waitForHealth() { |
| 186 | const deadline = Date.now() + 30_000; |
| 187 | while (Date.now() < deadline) { |
| 188 | try { |
| 189 | const health = await httpJson("/api/health"); |
| 190 | if (health.httpPort === serverPort) { |
| 191 | return; |
| 192 | } |
| 193 | } catch {} |
| 194 | await sleep(100); |
| 195 | } |
| 196 | throw new Error(`Timed out waiting for ${serverUrl}/api/health`); |
| 197 | } |
| 198 | |
| 199 | async function launchFixtureWithRecovery(appPath, options = {}) { |
| 200 | const recoveryCount = options.recoveryCount ?? 0; |