(host = '127.0.0.1')
| 592 | } |
| 593 | |
| 594 | async function allocateFreePort(host = '127.0.0.1'): Promise<number> { |
| 595 | const server = await listenOnce(host, 0); |
| 596 | const address = server.address(); |
| 597 | const port = typeof address === 'object' && address !== null ? address.port : 0; |
| 598 | await closeServer(server); |
| 599 | return port; |
| 600 | } |
| 601 | |
| 602 | /** |
| 603 | * Find the start of a run of `count` consecutive free ports |
no test coverage detected