mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 13:47:16 +00:00

Using `util.inspect` on errors is going to highlight userland and node_module stack frames from now on. This is done by marking Node.js core frames grey and frames that contain `node_modules` in their path yellow. That way it's easy to grasp what frames belong to what code. PR-URL: https://github.com/nodejs/node/pull/27052 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
23 lines
582 B
JavaScript
23 lines
582 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const vm = require('vm');
|
|
// 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' });
|
|
|
|
console.log(
|
|
new Error('test\n at abc (../fixtures/node_modules/bar.js:4:4)\nfoobar')
|
|
);
|
|
|
|
try {
|
|
require('../fixtures/node_modules/node_modules/bar.js');
|
|
} catch (err) {
|
|
console.log(err);
|
|
}
|
|
|
|
vm.runInThisContext('console.log(new Error())');
|