(port: number)
| 109 | // microseconds (close, then boot). Services bind 127.0.0.1 or dual-stack `::`, |
| 110 | // both of which succeed once the probes are released. |
| 111 | const bindProbe = async (port: number): Promise<ReadonlyArray<Server> | undefined> => { |
| 112 | const loopbacks = await Promise.all(["127.0.0.1", "::1"].map((host) => isListening(port, host))); |
| 113 | if (loopbacks.some(Boolean)) return undefined; |
| 114 | const v4 = await listenOn({ port, host: "0.0.0.0" }); |
| 115 | if (!v4) return undefined; |
| 116 | const v6 = await listenOn({ port, host: "::", ipv6Only: true }); |
| 117 | if (!v6) { |
| 118 | await closeServer(v4); |
| 119 | return undefined; |
| 120 | } |
| 121 | return [v4, v6]; |
| 122 | }; |
| 123 | |
| 124 | export interface PortClaim { |
| 125 | readonly envVar: string; |
no test coverage detected