MCPcopy Index your code
hub / github.com/nodejs/node / child

Function child

test/sequential/test-util-debug.js:113–133  ·  view source on GitHub ↗
(section)

Source from the content-addressed store, hash-verified

111
112
113function child(section) {
114 const tty = require('tty');
115 // Make sure we check for colors, no matter of the stream's default.
116 Object.defineProperty(process.stderr, 'hasColors', {
117 value: tty.WriteStream.prototype.hasColors,
118 });
119
120 let innerDebug = null;
121 // eslint-disable-next-line no-restricted-syntax
122 const debug = util.debuglog(section, common.mustCall((cb) => {
123 assert.strictEqual(typeof cb, 'function');
124 innerDebug = cb;
125 }));
126 debug('this', { is: 'a' }, /debugging/);
127 debug('num=%d str=%s obj=%j', 1, 'a', { foo: 'bar' });
128 console.log(debug.enabled ? 'outer enabled' : 'outer disabled');
129 console.log(innerDebug.enabled ? 'inner enabled' : 'inner disabled');
130
131 assert.strictEqual(typeof Object.getOwnPropertyDescriptor(debug, 'enabled').get, 'function');
132 assert.strictEqual(typeof Object.getOwnPropertyDescriptor(innerDebug, 'enabled').get, 'function');
133}

Callers 1

test-util-debug.jsFile · 0.70

Calls 4

requireFunction · 0.50
debugFunction · 0.50
definePropertyMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…