Skip to content

Commit

Permalink
test: gray out meta data when using --singleLine=true
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Mar 2, 2021
1 parent 657b7ba commit 6641ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const test = require('tap').test
const pino = require('pino')
const dateformat = require('dateformat')
const _prettyFactory = require('../')
const chalk = require('chalk')

function prettyFactory (opts) {
if (!opts) {
Expand Down Expand Up @@ -710,7 +711,7 @@ test('basic prettifier tests', (t) => {
const log = pino({}, new Writable({
write (chunk, enc, cb) {
const formatted = pretty(chunk.toString())
t.is(formatted, `[${epoch}] INFO (${pid} on ${hostname}): message {"extra":{"foo":"bar","number":42},"upper":"FOOBAR"}\n`)
t.is(formatted, `[${epoch}] INFO (${pid} on ${hostname}): message ${chalk.gray('{"extra":{"foo":"bar","number":42},"upper":"FOOBAR"}')}\n`)

cb()
}
Expand Down
3 changes: 2 additions & 1 deletion test/error-objects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Writable = require('stream').Writable
const os = require('os')
const test = require('tap').test
const pino = require('pino')
const chalk = require('chalk')
const serializers = pino.stdSerializers
const _prettyFactory = require('../')

Expand Down Expand Up @@ -133,7 +134,7 @@ test('error like objects tests', (t) => {
const formatted = pretty(chunk.toString())
const lines = formatted.split('\n')
t.is(lines.length, expected.length + 5)
t.is(lines[0], `[${epoch}] INFO (${pid} on ${hostname}): {"extra":{"a":1,"b":2}}`)
t.is(lines[0], `[${epoch}] INFO (${pid} on ${hostname}): ${chalk.gray('{"extra":{"a":1,"b":2}}')}`)
t.match(lines[1], /\s{4}err: {/)
t.match(lines[2], /\s{6}"type": "Error",/)
t.match(lines[3], /\s{6}"message": "hello world",/)
Expand Down

0 comments on commit 6641ce0

Please sign in to comment.