Skip to content

Commit

Permalink
refactor(unit/mocha.spec.js): Reparented '#reporter("xunit")#run(fn)'…
Browse files Browse the repository at this point in the history
… test suite

Moved aforementioned suite inside '#run()' test suite. Don't see its value as a variant of the
original test, but...
  • Loading branch information
plroebuck committed Feb 16, 2019
1 parent 442205f commit bf9939b
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions test/unit/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,13 @@ 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('#run(fn)', function() {
it('should execute the callback when complete', function(done) {
var mocha = new Mocha(opts);
sandbox.stub(Mocha.Runner.prototype, 'run').callsArg(0);
mocha.run(done);
});
});

describe('#run(fn)', function() {
it('should not raise errors if callback was not provided', function() {
sandbox.stub(Mocha.Runner.prototype, 'run');
var mocha = new Mocha(opts);
Expand All @@ -276,10 +268,19 @@ describe('Mocha', function() {
}, 'not to throw');
});

it('should execute the callback when complete', function(done) {
var mocha = new Mocha(opts);
sandbox.stub(Mocha.Runner.prototype, 'run').callsArg(0);
mocha.run(done);
describe('#reporter("xunit")#run(fn)', function() {
// :TBD: Why does specifying reporter differentiate this test from preceding one
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');
});
});
});

Expand Down

0 comments on commit bf9939b

Please sign in to comment.