Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

faster async tests

Tj Holowaychuk11489dc061f7
diff --git a/test/unit/hook.async.js b/test/unit/hook.async.js
index faa9ef4a..78cec657 100644
--- a/test/unit/hook.async.js
+++ b/test/unit/hook.async.js
@@ -18,15 +18,15 @@ describe('async', function(){
describe('beforeEach()', function(){
beforeEach(function(test, done){
- setTimeout(function(){
+ process.nextTick(function(){
calls.push('before ' + test.title);
done();
- }, 20);
+ });
});
it('one', function(done){
calls.should.eql(['before one']);
- setTimeout(done, 10);
+ process.nextTick(done);
});
it('two', function(){
@@ -46,10 +46,10 @@ describe('async', function(){
});
afterEach(function(test, done){
- setTimeout(function(){
+ process.nextTick(function(){
calls.push('after ' + test.title);
done();
- }, 20);
+ });
});
});
});
\ No newline at end of file