Skip to content

Instantly share code, notes, and snippets.

@incompl
Created September 2, 2013 17:30
Show Gist options
  • Save incompl/6415311 to your computer and use it in GitHub Desktop.
Save incompl/6415311 to your computer and use it in GitHub Desktop.
// tearDown is called after every test
// Shut down server and all clients
tearDown: function(callback) {
try {
_(clients).forEach(function(client) {
if (client.connected()) {
console.log('ending client');
client.end();
}
else {
console.log('client already disconnected');
}
});
clients = null;
console.log('stopping server');
this.server.stop(function() {
console.log('server stopped');
callback();
});
}
catch(e) {
console.error(e);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment