From 87ea70f651f42cb7cb4705006c58bac7c173db12 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 12 Feb 2017 18:44:57 +0000 Subject: [PATCH] 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. --- test/reporters/tap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/reporters/tap.js b/test/reporters/tap.js index 29a85f8c0..ececd9a6c 100644 --- a/test/reporters/tap.js +++ b/test/reporters/tap.js @@ -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(); });