Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be common.mustNotCall()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpinca Thanks for your comment. I fixed it.

});

[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'
}
);
});
}