Browse Source

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>
v6
DavidCai 8 years ago
committed by Franziska Hinkelmann
parent
commit
74bd3144d6
  1. 10
      test/parallel/test-console-instance.js

10
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$/);

Loading…
Cancel
Save