Skip to content

mocha loses the right title when done called multiple times  #1798

Closed
gluckgames/pixi-packer
#17

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions