Skip to content

Commit

Permalink
if a reporter has a .done method, call it before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
demmer committed Jul 12, 2014
1 parent 7ce102b commit 30582e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,5 +367,14 @@ Mocha.prototype.run = function(fn){
if (options.growl) this._growl(runner, reporter);
exports.reporters.Base.useColors = options.useColors;
exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
return runner.run(fn);

function done(failures) {
if (reporter.done) {
reporter.done(failures, fn);
} else {
fn(failures);
}
}

return runner.run(done);
};

0 comments on commit 30582e6

Please sign in to comment.