-
-
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
setTimeout() after done() is called (--watch mode) #3014
Comments
setTimeout
after done()
is called in watch mode
Calling |
Thanks for your answer. Please see/try the following test case. With With What is happening? it('passes, then throws after 10 secs but only in --watch', function(done) {
function myFunc(callback) {
callback('sync');
process.nextTick(function() { callback('async1'); });
setTimeout(function() { callback('async2'); }, 0);
setTimeout(function() { callback('async3'); }, 10000);
}
myFunc(function(data) {
assert.equal(data, 'sync');
done();
});
}); |
good question. |
I am a bot that watches issues for inactivity. |
Time travelers: This issue has been resolved since The behavior is now consistent (always throws) in normal and watch mode, both with and without the Thanks for the good work @boneskull and everyone! |
Hello, thanks for your work on this project.
The following test passes when calling
mocha
from cli, but the assertion throws after the test passes when adding the--watch
flag.Changing
setTimeout
toprocess.nextTick
makes the test always pass in both modes.Changing the delay on
setTimeout
to lower values (10ms) makes the test pass sometimes in watch mode.What is the expected behaviour?
Kind regards,
mocha 3.5.3
node 6.11.2
macOS 10.12.6
The text was updated successfully, but these errors were encountered: