chai-http
chai-http copied to clipboard
Please expose a cleanup method so that I can teardown my tests properly.
I am running into a common gulp-mocha issue where gulp cli completes executing all the tasks but it does not exit. This is because request creates a server when using a middleware app, but does not expose a method to destroy the procces and close the service. Since gulp cli listens for process exit event and request has created a service that is still listening the process exit event is not emitted.
This is now the default behaviour in mocha 4 as well. It caused my tests to hang. In mocha there's currently a CLI flag to revert to the old behaviour, but I wouldn't count on this being the case indefinitely.
Exposing a cleanup
or close
method on the server returned by chai.request
would be really useful.