-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Calling done() after this.skip() results in 'done() called multiple times' #2465
Comments
You don't need Either way, I'm pretty sure this is a legit bug -- once |
Hi @ScottFreeCode, thanks for responding.
I mean removing the call to done if
The above seems to work fine, but not sure if it was an intentional change from 2 => 3 or accidental one. |
Yeah, that seems like it should work, but it also seems like it shouldn't be necessary; @boneskull, do you know if there was any intended behavior change in 3.x that might be causing this? |
Yes. @cressie176 Mocha pre-v3 doesn't truly support describe('broken skip behaviour', function() {
it('should not report done() called multiple times', function(done) {
this.skip()
done() // this is never actually called.
})
}) But: describe('broken skip behaviour', function() {
it('should not report done() called multiple times', function(done) {
setTimeout(() => {
this.skip() // uncaught exception
done() // still never called
})
})
}) results in (again, Mocha 2.x here):
See this comment and subsequent discussion. But, yes, there's a bug here; Mocha 3.x does this: describe('broken skip behaviour', function() {
it('should not report done() called multiple times', function(done) {
this.skip()
done() // this actually gets called, which is wrong.
})
}) So that needs fixing; hopefully it won't be too much of a headache. |
- also fixes lack of support for async `skip()` when `allowUncaught` option is used - adds some debuggability into `this.skip()` calls
- also fixes lack of support for async `skip()` when `allowUncaught` option is used - adds some debuggability into `this.skip()` calls
…roperty-currentretry * upstream/master: helpful error when necessary suite callback omitted; closes mochajs#1744 Fix an issue and add relevant tests when describe and xdescribe fail when not supplied with a callback (issue mochajs#1744). rename more fixtures; closes mochajs#2383 Report non-match to STDERR and exit if no files are matched (mochajs#2450) Exit process with correct error codes (mochajs#2445) fix test files not using .spec suffix fix test fixtures not using .fixture suffix always halt execution when async skip() called; closes mochajs#2465 (mochajs#2479) avoid test flake in "delay" test; closes mochajs#2469 (mochajs#2470) revert accidental change to bin paths disregard function names when testing under Node.js 6.5.0; closes mochajs#2467 (mochajs#2477) lints more files; add more files to lint check; closes mochajs#2457 adds *.orig to .gitignore Exclude the --inspect flag fix check-leaks to catch a leak whose name begins with 'd'
…-files-cache * upstream/master: attempt windows-friendly reproducible case for mochajs#2315 fix: fix uncaught TypeError if error occurs on next tick, closes mochajs#2315 (mochajs#2439) helpful error when necessary suite callback omitted; closes mochajs#1744 Fix an issue and add relevant tests when describe and xdescribe fail when not supplied with a callback (issue mochajs#1744). rename more fixtures; closes mochajs#2383 Report non-match to STDERR and exit if no files are matched (mochajs#2450) Exit process with correct error codes (mochajs#2445) fix test files not using .spec suffix fix test fixtures not using .fixture suffix always halt execution when async skip() called; closes mochajs#2465 (mochajs#2479) avoid test flake in "delay" test; closes mochajs#2469 (mochajs#2470) revert accidental change to bin paths disregard function names when testing under Node.js 6.5.0; closes mochajs#2467 (mochajs#2477) lints more files; add more files to lint check; closes mochajs#2457 adds *.orig to .gitignore Exclude the --inspect flag fix check-leaks to catch a leak whose name begins with 'd'
…ochajs#2479) - always halt execution when async skip() called; closes mochajs#2465 - also fixes lack of support for async `skip()` when `allowUncaught` option is used - adds some debuggability into `this.skip()` calls - avoid double-failure conditions when using this.skip() - fix bad Runner tests; lint & add test/runner.js to check
The following code skips the test in mocha v2, but causes an error in v3
Test
v2 Output
v3 Output
Unfortunately I rely on this behaviour for skipping tests in Yadda.
I've tried with various version of mocha from 1-3 and it looks like I can simply remove the call to done() in all versions. Can you confirm?
The text was updated successfully, but these errors were encountered: