Mocha tests timeout if more than 4 tests are run at once Mocha tests timeout if more than 4 tests are run at once express express

Mocha tests timeout if more than 4 tests are run at once


With Mocha, if you declare a first argument to your (test) functions' callback (usually called done), you must call it, otherwise Mocha will wait until it's called (and eventually time out). If you're not going to need it in a test, don't declare it:

it('test1', function(done) {  ..  // 'done' declared, so call it (eventually, usually when some async action is done)  done();});it('test2', function() {  // not an async test, not declaring 'done', obviously no need to call it});

And since you're using http, try increasing http.globalAgent.maxSockets (which defaults to 5):

var http = require('http');http.globalAgent.maxSockets = 100;

(I believe 0 turns it off completely but I haven't tried).