SuperTest
Super-agent driven library for testing node.js HTTP servers
...You may pass an http.Server, or a Function to request(), if the server is not already listening for connections then it is bound to an ephemeral port for you so there is no need to keep track of ports. One thing to note, is that superagent now sends any HTTP error (anything other than a 2XX response code) to the callback as the first argument if you do not add a status code expect (i.e. .expect(302)). Expectations are run in the order of definition. This characteristic can be used to modify the response body or headers before executing an assertion.