node/test/pseudo-tty/console_colors.js
Anna Henningsen 565fd50b4a
console: auto-detect color support by default
This makes Node pretty-print objects with color by default
when `console.log()`-ing them.

PR-URL: https://github.com/nodejs/node/pull/19372
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-12 23:23:57 +02:00

10 lines
307 B
JavaScript

'use strict';
require('../common');
// Make this test OS-independent by overriding stdio getColorDepth().
process.stdout.getColorDepth = () => 8;
process.stderr.getColorDepth = () => 8;
console.log({ foo: 'bar' });
console.log('%s q', 'string');
console.log('%o with object format param', { foo: 'bar' });