(port: number)
| 122 | * Used in all polling loops instead of isProcessAlive() (which is slow on Windows). |
| 123 | */ |
| 124 | export async function isServerHealthy(port: number): Promise<boolean> { |
| 125 | try { |
| 126 | const resp = await fetch(`http://127.0.0.1:${port}/health`, { |
| 127 | signal: AbortSignal.timeout(2000), |
| 128 | }); |
| 129 | if (!resp.ok) return false; |
| 130 | const health = await resp.json() as any; |
| 131 | return health.status === 'healthy'; |
| 132 | } catch { |
| 133 | return false; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // ─── Process Management ───────────────────────────────────────── |
| 138 | async function killServer(pid: number): Promise<void> { |
no test coverage detected