Comparing version 0.0.3 to 0.0.4
0.0.4 / 2011-11-24 | ||
================== | ||
* Added `--interfaces` | ||
* Added `--reporters` | ||
* Added `-c, --colors`. Closes #69 | ||
* Fixed hook timeouts | ||
0.0.3 / 2011-11-23 | ||
@@ -3,0 +11,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.0.3'; | ||
exports.version = '0.0.4'; | ||
@@ -15,0 +15,0 @@ exports.interfaces = require('./interfaces'); |
@@ -120,8 +120,8 @@ | ||
var suite = this.suite | ||
, test = this.test | ||
, callbacks = suite[name + 'Callbacks'] | ||
, pending = callbacks.length; | ||
, ms = suite._timeout | ||
, timer; | ||
function next(i) { | ||
var callback = callbacks[i] | ||
var callback = callbacks[i]; | ||
if (!callback) return fn(); | ||
@@ -131,5 +131,11 @@ | ||
if (1 == callback.length) { | ||
// timeout | ||
timer = setTimeout(function(){ | ||
fn(new Error('timeout of ' + ms + 'ms exceeded')); | ||
}, ms); | ||
// async | ||
try { | ||
callback(function(err){ | ||
clearTimeout(timer); | ||
if (err) return fn(err); | ||
@@ -362,3 +368,2 @@ next(++i); | ||
this.hook('beforeAll', function(err){ | ||
// TODO: use interface names | ||
if (err) return self.failHook('beforeAll', err); | ||
@@ -365,0 +370,0 @@ self.runTests(suite, next); |
@@ -58,2 +58,3 @@ | ||
this.root = !title; | ||
this.timeout(2000); | ||
} | ||
@@ -60,0 +61,0 @@ |
{ | ||
"name": "mocha" | ||
, "version": "0.0.3" | ||
, "version": "0.0.4" | ||
, "description": "Test framework inspired by JSpec, Expresso, & Qunit" | ||
@@ -5,0 +5,0 @@ , "keywords": ["test", "bdd", "tdd", "tap"] |
describe('timeouts', function(){ | ||
beforeEach(function(done){ | ||
// uncomment | ||
// setTimeout(done, 3000); | ||
done(); | ||
}) | ||
it('should error on timeout', function(done){ | ||
@@ -7,3 +13,3 @@ // uncomment | ||
done(); | ||
}); | ||
}) | ||
}); |
Sorry, the diff of this file is not supported yet
116228
4277