(
dir: string,
overrides: Partial<Parameters<typeof startStaticServer>[0]> = {},
)
| 36 | }); |
| 37 | |
| 38 | async function startServer( |
| 39 | dir: string, |
| 40 | overrides: Partial<Parameters<typeof startStaticServer>[0]> = {}, |
| 41 | ) { |
| 42 | const server = await startStaticServer({ |
| 43 | port: 0, |
| 44 | host: "127.0.0.1", |
| 45 | dir, |
| 46 | routes: {}, |
| 47 | ...overrides, |
| 48 | }); |
| 49 | servers.push(server); |
| 50 | |
| 51 | const address = server.address(); |
| 52 | if (!address || typeof address === "string") { |
| 53 | throw new Error("Static server did not bind to a TCP port"); |
| 54 | } |
| 55 | |
| 56 | return `http://127.0.0.1:${address.port}`; |
| 57 | } |
| 58 | |
| 59 | async function startHttpServer(server: Server) { |
| 60 | await new Promise<void>((resolve, reject) => { |
no test coverage detected