Skip to content

Commit

Permalink
Setup error handler when allowUncaught.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrowe committed Feb 1, 2017
1 parent dae3428 commit f76afbc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f76afbc

Please sign in to comment.