test('dateformat', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'dateformat.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/\(123456 on abcdefghijklmnopqr\): h/), null) })
test('child should not share bindings of parent set after child creation', async ({ same }) => { const instance = pino({ name: 'basicTest', level: 'info' }) const child = instance.child({}) instance.setBindings({ foo: 'bar' }) same(instance.bindings(), { name: 'basicTest', foo: 'bar' }) same(child.bindings(), { name: 'basicTest' }) })
// https://github.com/pinojs/pino/issues/222 test('children with same names render in correct order', async ({ is }) => { const stream = sink() const root = pino(stream) root.child({ a: 1 }).child({ a: 2 }).info({ a: 3 }) const { a } = await once(stream, 'data') is(a, 3, 'last logged object takes precedence') })
test('clinic bubbleprof - should error early if non-node script', function (t) { cli({}, ['clinic', 'bubbleprof', '--', 'sh', 'wrapper.sh'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js BubbleProf[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic doctor --version', function (t) { cli({}, ['clinic', 'doctor', '--version'], function (err, stdout) { t.ifError(err) t.strictEqual( stdout, `v${require('@nearform/doctor/package.json').version}\n` ) t.end() }) })
test('clinic bubbleprof - should accept full path to node.js', function (t) { cli({}, ['clinic', 'bubbleprof', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'], function (err, stdout) { t.ifError(err) t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-bubbleprof/.test(stdout)) t.end() }) })
test('clinic bubbleprof --collect-only - should error early if non-node script', function (t) { cli({}, ['clinic', 'bubbleprof', '--collect-only', '--', 'sh', 'wrapper.sh'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js BubbleProf[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic doctor', function (t) { cli({}, ['clinic', 'doctor'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js Doctor[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic doctor --collect-only - should error early if non-node script', function (t) { cli({}, ['clinic', 'doctor', '--collect-only', '--', 'sh', 'wrapper.sh'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js Doctor[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })
test('clinic flame - should error early if non-node script', function (t) { cli({}, ['clinic', 'flame', '--', 'sh', 'wrapper.sh'], function (err, stdout) { t.strictDeepEqual(err, new Error('process exited with exit code 1')) t.ok(/Clinic.js Flame[^\w ]/.test(stdout.split('\n')[1])) t.end() }) })