Skip to content

Commit

Permalink
use hooks for stubs with base test
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaub committed Apr 10, 2019
1 parent a08daa8 commit fec1027
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/reporters/base.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,24 @@ describe('Base reporter', function() {
expect(errOut, 'to be', '1) test title:\n Error\n foo\n bar');
});

it('should let you stub out console.log without effecting reporters output', function() {
sinon.stub(console, 'log');
sinon.stub(Base, 'consoleLog');
Base.list([]);
describe('when reporter output immune to user test changes', function() {
var sandbox;

expect(Base.consoleLog, 'was called');
expect(console.log, 'was not called');
beforeEach(function() {
sandbox = sinon.createSandbox();
sandbox.stub(console, 'log');
sandbox.stub(Base, 'consoleLog').callThrough();
});

console.log.restore();
Base.consoleLog.restore();
it('should let you stub out console.log without effecting reporters output', function() {
Base.list([]);

expect(Base.consoleLog, 'was called');
expect(console.log, 'was not called');
});

afterEach(function() {
sandbox.restore();
});
});
});

0 comments on commit fec1027

Please sign in to comment.