(url: string)
| 69 | } |
| 70 | |
| 71 | async function probeHealth(url: string): Promise<void> { |
| 72 | const healthUrl = `${stripTrailingSlash(toHttpUrl(url))}/health`; |
| 73 | let response: Response; |
| 74 | try { |
| 75 | response = await fetch(healthUrl); |
| 76 | } catch (cause) { |
| 77 | throw new Error( |
| 78 | `TestBackend: ${healthUrl} is not reachable. ` + |
| 79 | `Is the computerd container running? (${cause instanceof Error ? cause.message : String(cause)})`, |
| 80 | ); |
| 81 | } |
| 82 | if (!response.ok) { |
| 83 | throw new Error(`TestBackend: ${healthUrl} returned ${response.status} ${response.statusText}`); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | function toHttpUrl(input: string): string { |
| 88 | if (input.startsWith("ws://")) return `http://${input.slice("ws://".length)}`; |
no test coverage detected