test-listen
URLs with ephemeral ports. async
/await
ready.
Usage
Install it:
npm install --save-dev test-listen
Pass a http.Server
to test-listen
and it will return an URL in the format http://localhost:{port}
.
The second parameter can optionally be a hostname to return in the URL
instead of localhost
.
Useful for running HTTP server testsuites:
const http = ;const listen = ; const srv = httpconst srv2 = http
Authors
- Guillermo Rauch (@rauchg) - ▲ZEIT
- Leo Lamprecht (@notquiteleo) - ▲ZEIT