Closed
Description
openedon Sep 26, 2017
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
to process.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?
var assert = require('assert');
describe('Works consistently in regular cli and watch mode', function() {
it('ignores setTimeout after done is called', function(done) {
function myFunc(callback) {
callback('sync');
setTimeout(function() { callback('async'); }, 100);
}
myFunc(function(data) {
assert.equal(data, 'sync');
done();
});
});
});
Kind regards,
mocha 3.5.3
node 6.11.2
macOS 10.12.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment