(
dir: string,
overrides: Partial<Parameters<typeof startStaticServer>[0]> = {},
)
| 26 | }); |
| 27 | |
| 28 | async function startServer( |
| 29 | dir: string, |
| 30 | overrides: Partial<Parameters<typeof startStaticServer>[0]> = {}, |
| 31 | ) { |
| 32 | const server = await startStaticServer({ |
| 33 | port: 0, |
| 34 | host: "127.0.0.1", |
| 35 | dir, |
| 36 | routes: {}, |
| 37 | ...overrides, |
| 38 | }); |
| 39 | servers.push(server); |
| 40 | |
| 41 | const address = server.address(); |
| 42 | if (!address || typeof address === "string") { |
| 43 | throw new Error("Static server did not bind to a TCP port"); |
| 44 | } |
| 45 | |
| 46 | return `http://127.0.0.1:${address.port}`; |
| 47 | } |
| 48 | |
| 49 | async function startHttpServer(server: Server) { |
| 50 | await new Promise<void>((resolve, reject) => { |
no test coverage detected