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

specify type of runnable in multiple done error #1890

Closed
dasilvacontin opened this issue Sep 14, 2015 · 3 comments
Closed

specify type of runnable in multiple done error #1890

dasilvacontin opened this issue Sep 14, 2015 · 3 comments

Comments

@dasilvacontin
Copy link
Contributor

before:

 1) suite test1:
     Uncaught Error: done() called multiple times
      at Suite.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:2:3)
      at Object.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:1:63)
      at Array.forEach (native)
      at node.js:814:3

after:

 1) suite test1:
     Uncaught Error: done() called multiple times in `beforeEach` hook
      at Suite.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:2:3)
      at Object.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:1:63)
      at Array.forEach (native)
      at node.js:814:3
@danielstjules
Copy link
Contributor

Looks like a duplicate of #1798 since #1889 fixes exactly that?

$ cat test/integration/fixtures/multiple.done.beforeEach.js
describe('suite', function() {
  beforeEach(function(done) {
    setTimeout(done, 10);
    setTimeout(done, 20);
  });

  it('test1', function(done) {
    setTimeout(done, 50);
  });

  it('test2', function(done) {
    setTimeout(done, 50);
  });
});
danielstjules:~/git/mocha (issue-1798)
$ ./bin/mocha test/integration/fixtures/multiple.done.beforeEach.js


  ․․․․

  2 passing (133ms)
  2 failing

  1) suite "before each" hook:
     Error: done() called multiple times
      at Hook.Runnable (lib/runnable.js:54:17)
      at new Hook (lib/hook.js:22:12)
      at Suite.beforeEach (lib/suite.js:237:14)
      at beforeEach (lib/interfaces/common.js:52:17)
      at Suite.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:2:3)
      at context.describe.context.context (lib/interfaces/bdd.js:47:10)
      at Object.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:1:63)
      at Array.forEach (native)
      at Object.<anonymous> (bin/_mocha:393:18)
      at node.js:951:3

  2) suite "before each" hook:
     Error: done() called multiple times
      at Hook.Runnable (lib/runnable.js:54:17)
      at new Hook (lib/hook.js:22:12)
      at Suite.beforeEach (lib/suite.js:237:14)
      at beforeEach (lib/interfaces/common.js:52:17)
      at Suite.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:2:3)
      at context.describe.context.context (lib/interfaces/bdd.js:47:10)
      at Object.<anonymous> (test/integration/fixtures/multiple.done.beforeEach.js:1:63)
      at Array.forEach (native)
      at Object.<anonymous> (bin/_mocha:393:18)
      at node.js:951:3

I think you were using mocha rather than /path/to/repo/mocha/bin/mocha

@danielstjules
Copy link
Contributor

Note that it doesn't say suite test1: since that's misleading - instead it correctly attributes the error to suite "before each" hook:

@dasilvacontin
Copy link
Contributor Author

I think you were using mocha rather than /path/to/repo/mocha/bin/mocha

Bingo. I was furthermore confused due to test helpers actually using the dev source code.

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

2 participants