Description
openedon Jul 14, 2015
I just finished trouble-shooting a wierd "done called multiple times" message.... phewee.. here's a tricky one:
I had a before-all hook that looked as following:
{ "lib/rest" :
{ beforeAll:
function(done) {
this.slow("1.1s");
rest = require('../lib/rest')(sockets, eventsHandler, done);
setTimeout(done, 1000)
}
,
Where evidently, the done is called both from ../lib/rest
and the setTimeout
.
Anyway, the ../lib/rest
was not calling the callback for a long time, and evidently, making it call the callback as it should - was actually what broke the build.
(I'm using mocha-ui-exports, that's why it looks like that)
However, mocha could not direct me to the right place - probably because the setTimeout
handler that was fired after 1s - was called in the midst of some other suite that followed - and mocha was pointing me to the suite and the test that during it's run the timer was fired...
looking there obviously brought nothing, and pending the tests that were reported as failing just moved the failure to another test that was not pended - and that's where I started suspecting that mocha reports the wrong place, and expanded my search.
After fixing the issue (removing the setTimeout
from the beforeAll
hook) - the suite passes.