Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Qard opened this issue Nov 5, 2014 · 5 comments
Closed

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

Qard opened this issue Nov 5, 2014 · 5 comments
Assignees

Comments

@Qard
Copy link

Qard commented Nov 5, 2014

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.

@boneskull boneskull self-assigned this Nov 6, 2014
@boneskull
Copy link
Contributor

I'll look into this since it's probably my code.

@LeonFedotov
Copy link

👍

@victorbadila
Copy link

+1 got the same error in a very similar case. tested this particular case and it happened just as described, I can confirm the behaviour.

@davija
Copy link

davija commented Oct 11, 2015

I am seeing the same behavior. Has this been researched yet? This is almost a year old now.

davija added a commit to davija/mocha that referenced this issue Oct 12, 2015
@kenr
Copy link

kenr commented Oct 15, 2015

I'm also experiencing the same problem. Lost about an hour of work figuring out this was a bug in mocha and not the usage of mocha.

boneskull added a commit that referenced this issue Oct 10, 2016
…nkleonrose/mocha into pull/2059

* 'fix-1417-multiple-done-calls' of https://github.com/frankleonrose/mocha:
  Fix #1417: Show actual error, not 'multiple calls to done()'

# Conflicts:
#	test/integration/regression.js
sgilroy pushed a commit to TwineHealth/mocha that referenced this issue Feb 27, 2019
…nkleonrose/mocha into pull/2059

* 'fix-1417-multiple-done-calls' of https://github.com/frankleonrose/mocha:
  Fix mochajs#1417: Show actual error, not 'multiple calls to done()'

# Conflicts:
#	test/integration/regression.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants