node/test/pseudo-tty/console_colors.js
RafaelGSS fbdfe9399c lib: add diagnostics_channel events to module loading
This commit adds a tracing channel for module loading
through `import()` and `require()`.

Co-Authored-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: https://github.com/nodejs/node/pull/44340
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2024-06-20 21:25:04 -03:00

24 lines
617 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;
Error.stackTraceLimit = Infinity;
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())');