Skip to content

Commit

Permalink
Ensure TAP reporter test does not write to stderr (#1240)
Browse files Browse the repository at this point in the history
Stub process.stderr.write(), rather than just spying on it. Otherwise
'resultresult' gets written to the stderr while the tests run.
  • Loading branch information
novemberborn authored and sindresorhus committed Feb 12, 2017
1 parent 09a4765 commit 87ea70f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/reporters/tap.js
Expand Up @@ -209,12 +209,12 @@ test('write should call console.log', t => {

test('stdout and stderr should call process.stderr.write', t => {
const reporter = new TapReporter();
const spy = sinon.spy(process.stderr, 'write');
const stub = sinon.stub(process.stderr, 'write');

reporter.stdout('result');
reporter.stderr('result');

t.is(spy.callCount, 2);
process.stderr.write.restore();
t.is(stub.callCount, 2);
t.end();
});

0 comments on commit 87ea70f

Please sign in to comment.