Skip to content

Commit

Permalink
test: add test to check colorMode type of Console
Browse files Browse the repository at this point in the history
PR-URL: #21248
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Lance Ball <lball@redhat.com>
  • Loading branch information
Masashi Hirano authored and addaleax committed Jun 14, 2018
1 parent e11447a commit 271a861
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/parallel/test-console-tty-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,27 @@ check(true, true, true);
check(false, true, true);
check(true, false, false);
check(false, false, false);

// check invalid colorMode type
{
const stream = new Writable({
write: common.mustNotCall()
});

[0, 'true', null, {}, [], () => {}].forEach((colorMode) => {
const received = util.inspect(colorMode);
assert.throws(
() => {
new Console({
stdout: stream,
ignoreErrors: false,
colorMode: colorMode
});
},
{
message: `The argument 'colorMode' is invalid. Received ${received}`,
code: 'ERR_INVALID_ARG_VALUE'
}
);
});
}

0 comments on commit 271a861

Please sign in to comment.