Skip to content

Commit 87ea70f

Browse files
novemberbornsindresorhus
authored andcommitted
Ensure TAP reporter test does not write to stderr (#1240)
Stub process.stderr.write(), rather than just spying on it. Otherwise 'resultresult' gets written to the stderr while the tests run.
1 parent 09a4765 commit 87ea70f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/reporters/tap.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ test('write should call console.log', t => {
209209

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

214214
reporter.stdout('result');
215215
reporter.stderr('result');
216216

217-
t.is(spy.callCount, 2);
218217
process.stderr.write.restore();
218+
t.is(stub.callCount, 2);
219219
t.end();
220220
});

0 commit comments

Comments
 (0)