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 May 17, 2014
1 parent a1cb3bb commit 6acbc7f
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 6acbc7f

Please sign in to comment.