question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"done" should fail when called multiple times

See original GitHub issue

I did some online searching and didn’t find any discussion, so let me know if this is as expected. Happy to do a PR if this should be correct behavior

🐛 Bug Report

Calling done() multiple times in one test should be a failure, but it succeeds

To Reproduce

it('should fail when done called second time', done => {
  done();
  done();
});

Expected behavior

Test fails with "done" called multiple times or some such message

Link to repl or repo (highly encouraged)

Above code snippet showcases issue. Looks like following test could be added to e2e failures:

test('done();done()', done => {
  done();
  done();
});

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
  Binaries:
    Node: 10.3.0 - /usr/local/bin/node
    Yarn: 1.5.1 - /usr/local/bin/yarn
    npm: 6.1.0 - /usr/local/bin/npm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
jmcsilva98commented, Nov 28, 2018

Hello, me and another student are trying to fix this issue for a course in college. However, it’s our first time working with jest so we are not so sure which files to run to reproduce this issue… Can you please replicate it in repl.it?

1reaction
SimenBcommented, Oct 11, 2020

That would be great, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event-based unit tests fail with "done() called multiple times"
I have a simple async callback test that I've set up with mocha : describe('test', function () { it('should not work', function(done) {...
Read more >
Unit Test calles multiple times done - Creating Nodes
Hello, i have a problem with a unit test. The node i develope sends msg in a loop like this: for( let i...
Read more >
BuiltIn
Should Be Equal and Should Be Equal As Strings report the failures using unified diff format if both strings have more than two...
Read more >
Events | Node.js v19.3.0 Documentation
Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.
Read more >
Spark Streaming Programming Guide
There is a newer and easier to use streaming engine in Spark called ... In this case, each line will be split into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found