test('ignores `undefined` from prettifier', async ({ is }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'skipped-output.js')]) child.stdout.pipe(writer((s, enc) => { actual += s })) await once(child, 'close') is(actual, '') })
explicitVersion(process.argv[2]) .then(null, findLatestVersion) .then(fetchDocs) .then(renderPost) .then(writeToFile) .then((filepath) => { console.log('Release post created:', filepath) }, (err) => { console.error('Some error occurred here!', err.stack) process.exit(1) })
function main() { let n = process.argv[2] || 20 // console.log(buildExtend(n)) console.log(buildInterface(n)) }
process.argv.slice(2).reduce((processArgs, val) => { let [key, value] = val.split('='); processArgs[key] = value; return processArgs; }, {})
test('applies updated chindings', async ({ is, isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'child-with-updated-chindings.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/foo: 123/), null) isNot(strip(actual).match(/foo: 456/), null) isNot(strip(actual).match(/bar: 789/), null) })
test('with custom timestamp', async ({ is }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'custom-time.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') is(strip(actual).slice(0, 6), '[test]') })
test('sync false logs everything when calling flushSync', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'syncfalse-flush-exit.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(actual.match(/hello/), null) isNot(actual.match(/world/), null) })
test('final works without prior logging', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'final-no-log-before.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/WARN\s+: pino.final with prettyPrint does not support flushing/), null) isNot(strip(actual).match(/INFO\s+\(123456 on abcdefghijklmnopqr\): beforeExit/), null) })
test('can be enabled via exported pino function with prettifier', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'pretty-factory.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/^INFO.*h/), null) })
test('pino with no args log everything when calling process.exit(0)', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'default-exit.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(actual.match(/hello/), null) isNot(actual.match(/world/), null) })
test('applies formatters', async ({ is, isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'formatters.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/\(123456 on abcdefghijklmnopqr\): h/), null) isNot(strip(actual).match(/foo: "formatted_bar"/), null) })
test('with custom timestamp label', async ({ is }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'custom-time-label.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') is(strip(actual).slice(0, 6), '[test]') })
test('errors', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'error.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/\(123456 on abcdefghijklmnopqr\): kaboom/), null) isNot(strip(actual).match(/\(123456 on abcdefghijklmnopqr\): with a message/), null) isNot(strip(actual).match(/.*error\.js.*/), null) })
test('final works with pretty', async ({ isNot }) => { var actual = '' const child = execa(process.argv[0], [join(__dirname, 'fixtures', 'pretty', 'final.js')]) child.stdout.pipe(writer((s, enc, cb) => { actual += s cb() })) await once(child, 'close') isNot(strip(actual).match(/WARN\s+\(123456 on abcdefghijklmnopqr\): pino.final with prettyPrint does not support flushing/), null) isNot(strip(actual).match(/INFO\s+\(123456 on abcdefghijklmnopqr\): beforeExit/), null) })