Permalink
Browse files

using process.nextTick instead of setTimeout, its faster.

  • Loading branch information...
1 parent 72aed2e commit b283854e2b13be72c914ebe6460f81fd3f4554cf @refractalize committed Aug 20, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 cupoftea_test.js
View
@@ -42,7 +42,7 @@ spec('cupoftea', function () {
spec('should not call (failing)', function () {
d('should not call');
- setTimeout(shouldNotCall(), 1000);
+ process.nextTick(shouldNotCall());
assert.equal(x, 10);
});
@@ -54,18 +54,18 @@ spec('cupoftea', function () {
spec('should call', function () {
d('should call');
- setTimeout(shouldCall(function () {
+ process.nextTick(shouldCall(function () {
d('stuff');
- }), 1000);
+ }));
assert.equal(x, 10);
});
spec('should call but exception thrown (failing)', function () {
d('should call');
- setTimeout(shouldCall(function () {
+ process.nextTick(shouldCall(function () {
d('stuff');
throw new Error('exception!');
- }), 1000);
+ }));
assert.equal(x, 10);
});

0 comments on commit b283854

Please sign in to comment.