diff --git a/lib/runnable.js b/lib/runnable.js index e7b6aa12f0..ee8c4a3467 100644 --- a/lib/runnable.js +++ b/lib/runnable.js @@ -324,8 +324,11 @@ Runnable.prototype.run = function (fn) { } if (this.allowUncaught) { - callFn(this.fn); - done(); + if (this.isPending()) { + done(); + } else { + callFn(this.fn); + } return; } diff --git a/lib/runner.js b/lib/runner.js index 1d3dd959da..b024e0dcb5 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -432,15 +432,14 @@ Runner.prototype.runTest = function (fn) { if (this.asyncOnly) { test.asyncOnly = true; } - + test.on('error', function (err) { + self.fail(test, err); + }); if (this.allowUncaught) { test.allowUncaught = true; return test.run(fn); } try { - test.on('error', function (err) { - self.fail(test, err); - }); test.run(fn); } catch (err) { fn(err);