Comparing version 0.0.5 to 0.0.6
0.0.6 / 2011-11-25 | ||
================== | ||
* Fixed return on immediate async error. Closes #80 | ||
0.0.5 / 2011-11-24 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.0.5'; | ||
exports.version = '0.0.6'; | ||
@@ -15,0 +15,0 @@ exports.interfaces = require('./interfaces'); |
@@ -254,3 +254,3 @@ | ||
try { | ||
return test.run(function(err){ | ||
test.run(function(err){ | ||
if (test.finished) { | ||
@@ -265,2 +265,4 @@ self.fail(test, new Error('done() called multiple times')); | ||
} | ||
return; | ||
} | ||
@@ -267,0 +269,0 @@ |
24
mocha.js
@@ -363,3 +363,3 @@ | ||
exports.version = '0.0.2'; | ||
exports.version = '0.0.5'; | ||
@@ -485,4 +485,4 @@ exports.interfaces = require('./interfaces'); | ||
// format | ||
var fmt = color('error title', ' %s) %s: ') | ||
+ color('error message', '%s') | ||
var fmt = color('error title', ' %s) %s:\n') | ||
+ color('error message', ' %s') | ||
+ color('error stack', '\n%s\n'); | ||
@@ -1558,8 +1558,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(); | ||
@@ -1569,5 +1569,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); | ||
@@ -1688,3 +1694,3 @@ next(++i); | ||
try { | ||
return test.run(function(err){ | ||
test.run(function(err){ | ||
if (test.finished) { | ||
@@ -1699,2 +1705,4 @@ self.fail(test, new Error('done() called multiple times')); | ||
} | ||
return; | ||
} | ||
@@ -1802,3 +1810,2 @@ | ||
this.hook('beforeAll', function(err){ | ||
// TODO: use interface names | ||
if (err) return self.failHook('beforeAll', err); | ||
@@ -1894,2 +1901,3 @@ self.runTests(suite, next); | ||
this.root = !title; | ||
this.timeout(2000); | ||
} | ||
@@ -1896,0 +1904,0 @@ |
{ | ||
"name": "mocha" | ||
, "version": "0.0.5" | ||
, "version": "0.0.6" | ||
, "description": "Test framework inspired by JSpec, Expresso, & Qunit" | ||
@@ -5,0 +5,0 @@ , "keywords": ["test", "bdd", "tdd", "tap"] |
116557
4284