test: increase coverage of console

PR-URL: https://github.com/nodejs/node/pull/11653
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
DavidCai authored and Franziska Hinkelmann committed 2017-03-09 11:31:10 +01:00
1 parent dd76f5f661
commit 74bd3144d6
1 file changed
+10
+10
View File
@@ -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$/);