From 7ac0db140a0946fc4a7298183d5411bd3f07d0e1 Mon Sep 17 00:00:00 2001 From: DavidCai Date: Thu, 2 Mar 2017 21:26:28 +0800 Subject: [PATCH] test: increase coverage of console PR-URL: https://github.com/nodejs/node/pull/11653 Reviewed-By: Claudio Rodriguez Reviewed-By: Michael Dawson Reviewed-By: Sakthipriyan Vairamani Reviewed-By: James M Snell Reviewed-By: Yuta Hiroto Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/parallel/test-console-instance.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index ac785e2d8c943c..e74edfae2feaef 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -57,3 +57,13 @@ out.write = common.mustCall((d) => { assert.doesNotThrow(() => { Console(out, err); }); + +// Instance that does not ignore the stream errors. +const c2 = new Console(out, err, false); + +out.write = () => { throw new Error('out'); }; +err.write = () => { throw new Error('err'); }; + +assert.throws(() => c2.log('foo'), /^Error: out$/); +assert.throws(() => c2.warn('foo'), /^Error: err$/); +assert.throws(() => c2.dir('foo'), /^Error: out$/);