From f76afbc489ba38a9d3a415b75c921b121b4b3afe Mon Sep 17 00:00:00 2001 From: Laurence Rowe Date: Tue, 31 Jan 2017 19:26:25 -0800 Subject: [PATCH] Setup error handler when allowUncaught. --- lib/runner.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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);