ladjs / supertest

🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
MIT License
13.82k stars 759 forks source link

Request and Agent do not expose a destructor to clean up services, preventing nodejs from emitting an 'exited' event #243

Closed Jhorlin closed 5 years ago

Jhorlin commented 9 years ago

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.

tcurdt commented 8 years ago

I've run into a similar problem.

https://github.com/substack/tape/issues/216

Given that we cannot use the usual signal handling way there is a need for some kind of callback/hook to shut everything down properly.

ghost commented 8 years ago

I'm using supertest with vows (vowsjs.org) and I believe that I need to manually clean up the server and kill the process. +1 on adding the ability to close it out cleanly rather than process.exit()

jknight12882 commented 7 years ago

👍 on this