Skip to content

Commit

Permalink
added allowUncaught option (mochajs#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
amsul committed Apr 18, 2015
1 parent 0207fba commit 4cb1db4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/runnable.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,22 @@ Runnable.prototype.run = function(fn){
});
} else {
if (self.asyncOnly) {
}
}

function callFnAsync(fn) {
fn.call(ctx, function(err){
if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
if (null != err) {
if (Object.prototype.toString.call(err) === '[object Object]') {
return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
} else {
return done(new Error('done() invoked with non-Error: ' + err));
}
}

done();
}
});
}

function callFnAsync(fn) {
Expand Down

0 comments on commit 4cb1db4

Please sign in to comment.