@@ -44,3 +44,27 @@ check(true, true, true);
|
44 | 44 | check(false, true, true); |
45 | 45 | check(true, false, false); |
46 | 46 | check(false, false, false); |
| 47 | + |
| 48 | +// check invalid colorMode type |
| 49 | +{ |
| 50 | +const stream = new Writable({ |
| 51 | +write: common.mustNotCall() |
| 52 | +}); |
| 53 | + |
| 54 | +[0, 'true', null, {}, [], () => {}].forEach((colorMode) => { |
| 55 | +const received = util.inspect(colorMode); |
| 56 | +assert.throws( |
| 57 | +() => { |
| 58 | +new Console({ |
| 59 | +stdout: stream, |
| 60 | +ignoreErrors: false, |
| 61 | +colorMode: colorMode |
| 62 | +}); |
| 63 | +}, |
| 64 | +{ |
| 65 | +message: `The argument 'colorMode' is invalid. Received ${received}`, |
| 66 | +code: 'ERR_INVALID_ARG_VALUE' |
| 67 | +} |
| 68 | +); |
| 69 | +}); |
| 70 | +} |