Skip to content

Commit

Permalink
test: increase coverage of console
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#11653
Reviewed-By: Claudio Rodriguez <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
  • Loading branch information
DavidCai1111 authored and andrew749 committed Jul 19, 2017
1 parent d44615c commit 72d357c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-console-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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$/);

0 comments on commit 72d357c

Please sign in to comment.