()
| 10 | import { listenOnRandomPort } from '../helpers/http.js'; |
| 11 | |
| 12 | async function getFreePort() { |
| 13 | return new Promise(res => { |
| 14 | const srv = netCreateServer(); |
| 15 | srv.listen(0, () => { |
| 16 | const address = srv.address()!; |
| 17 | if (typeof address === 'string') { |
| 18 | throw new Error('Unexpected address type: ' + typeof address); |
| 19 | } |
| 20 | const port = (address as AddressInfo).port; |
| 21 | srv.close(_err => res(port)); |
| 22 | }); |
| 23 | }); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Test server configuration for StreamableHTTPServerTransport tests |
no test coverage detected
searching dependent graphs…