I\'m testing a Nodejs server with Mocha and Supertest. The test suite has grown to more than 1500 tests. Suddenly, although all of the code under test still works, my test suite
I found the answer in this Google Groups post by Mike Gradek:
We used mocha and supertest to issue these requests, and realized that we were actually spinning up new port bindings on every request instead of reusing existing bindings.
So code that was written like so:
var request = require('supertest');
var app = require('../app');
request(app).get(...);
request(app).get(...);
Became
var request = require('supertest');
var app = require('../app');
var supertest = request(app);
supertest.get(...);
supertest.get(...);
That solved the issue for us.
And for me as well.