Skip to content

Commit

Permalink
Merge 8736b46 into a9f3526
Browse files Browse the repository at this point in the history
  • Loading branch information
Lana-Light committed Dec 22, 2018
2 parents a9f3526 + 8736b46 commit ff5bdbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mocha.js
Expand Up @@ -781,10 +781,11 @@ Mocha.prototype.run = function(fn) {
exports.reporters.Base.hideDiff = options.hideDiff;

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

Expand Down
14 changes: 14 additions & 0 deletions test/unit/mocha.spec.js
Expand Up @@ -56,6 +56,20 @@ describe('Mocha', function() {
});
});

describe('.reporter("xunit").run(fn)', function() {
it('should not raise errors if callback was not provided', function() {
var mocha = new Mocha();
expect(function() {
try {
mocha.reporter('xunit').run();
} catch (e) {
console.log(e);
expect.fail(e.message);
}
}, 'not to throw');
});
});

describe('.addFile()', function() {
it('should add the given file to the files array', function() {
var mocha = new Mocha(opts);
Expand Down

0 comments on commit ff5bdbe

Please sign in to comment.