Skip to content

Error in "done() called multiple times" assumptions #1417

Closed

Description

This code here will hide the true error of certain failed async tests:

https://github.com/mochajs/mocha/blob/master/lib/runnable.js#L216-L230

To reproduce, try this:

it('should work', function (done) {
  setImmediate(done)
  throw new Error('hidden')
})

You will never see the error with the "hidden" message. It will just tell you done was called twice, which is terribly misleading, as the user code only called it once.

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

Metadata

Assignees

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