(section)
| 111 | |
| 112 | |
| 113 | function 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 | } |
no test coverage detected
searching dependent graphs…