Skip to content

Commit

Permalink
Update dependencies (#346)
Browse files Browse the repository at this point in the history
* Update dependencies

* Fix Node 18
  • Loading branch information
jsumners authored Jun 10, 2022
1 parent 3dbcd21 commit 3ecbfb1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 34 deletions.
42 changes: 21 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,40 +62,40 @@ function prettyFactory (options) {
const useOnlyCustomProps = typeof opts.useOnlyCustomProps === 'boolean' ? opts.useOnlyCustomProps : opts.useOnlyCustomProps === 'true'
const customLevels = opts.customLevels
? opts.customLevels
.split(',')
.reduce((agg, value, idx) => {
const [levelName, levelIdx = idx] = value.split(':')
.split(',')
.reduce((agg, value, idx) => {
const [levelName, levelIdx = idx] = value.split(':')

agg[levelIdx] = levelName.toUpperCase()
agg[levelIdx] = levelName.toUpperCase()

return agg
}, { default: 'USERLVL' })
return agg
}, { default: 'USERLVL' })
: {}
const customLevelNames = opts.customLevels
? opts.customLevels
.split(',')
.reduce((agg, value, idx) => {
const [levelName, levelIdx = idx] = value.split(':')
.split(',')
.reduce((agg, value, idx) => {
const [levelName, levelIdx = idx] = value.split(':')

agg[levelName.toLowerCase()] = levelIdx
agg[levelName.toLowerCase()] = levelIdx

return agg
}, {})
return agg
}, {})
: {}
const customColors = opts.customColors
? opts.customColors
.split(',')
.reduce((agg, value) => {
const [level, color] = value.split(':')
.split(',')
.reduce((agg, value) => {
const [level, color] = value.split(':')

const condition = useOnlyCustomProps ? opts.customLevels : customLevelNames[level] !== undefined
const levelNum = condition ? customLevelNames[level] : LEVEL_NAMES[level]
const colorIdx = levelNum !== undefined ? levelNum : level
const condition = useOnlyCustomProps ? opts.customLevels : customLevelNames[level] !== undefined
const levelNum = condition ? customLevelNames[level] : LEVEL_NAMES[level]
const colorIdx = levelNum !== undefined ? levelNum : level

agg.push([colorIdx, color])
agg.push([colorIdx, color])

return agg
}, [])
return agg
}, [])
: undefined
const customProps = {
customLevels,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"colorette": "^2.0.7",
"dateformat": "^4.6.3",
"fast-copy": "^2.1.1",
"fast-safe-stringify": "^2.0.7",
"fast-safe-stringify": "^2.1.1",
"joycon": "^3.1.1",
"on-exit-leak-free": "^1.0.0",
"pino-abstract-transport": "^0.5.0",
Expand All @@ -48,11 +48,11 @@
},
"devDependencies": {
"@types/node": "^17.0.0",
"pino": "^7.0.0",
"pino": "^8.0.0",
"pre-commit": "^1.2.2",
"rimraf": "^3.0.2",
"snazzy": "^9.0.0",
"standard": "^16.0.3",
"standard": "^17.0.0",
"tap": "^16.0.0",
"tsd": "^0.20.0",
"typescript": "^4.4.3"
Expand Down
8 changes: 4 additions & 4 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ test('basic prettifier tests', (t) => {

const opts = {
base: {
name: name,
hostname: hostname
name,
hostname
}
}
const log = pino(opts, new Writable({
Expand All @@ -401,7 +401,7 @@ test('basic prettifier tests', (t) => {

const opts = {
base: {
name: name,
name,
pid: process.pid
}
}
Expand All @@ -424,7 +424,7 @@ test('basic prettifier tests', (t) => {

const opts = {
base: {
hostname: hostname,
hostname,
pid: process.pid
}
}
Expand Down
5 changes: 4 additions & 1 deletion test/cli-rc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ test('cli', (t) => {
const child = spawn(process.argv[0], args, { env, cwd: tmpDir })
child.on('close', (code) => t.equal(code, 1))
child.stderr.on('data', (data) => {
t.equal(data.indexOf('Error: Failed to load runtime configuration file: pino-pretty.config.missing.json') >= 0, true)
t.equal(
data.toString().indexOf('Error: Failed to load runtime configuration file: pino-pretty.config.missing.json') >= 0,
true
)
})
t.teardown(() => child.kill())
})
Expand Down
9 changes: 5 additions & 4 deletions test/error-objects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,11 @@ test('error like objects tests', { only: true }, (t) => {
t.test('handles errors with a null stack for Error object', (t) => {
const pretty = prettyFactory()
const expectedLines = [
'"type": "Error"',
'"message": "error message"',
'"stack": null',
'"some": "property"'
' "type": "Error",',
' "message": "error message",',
' "stack":',
' ',
' "some": "property"'
]
t.plan(expectedLines.length)
const log = pino({}, new Writable({
Expand Down
2 changes: 1 addition & 1 deletion test/lib/utils.public.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ tap.test('#filterLog', t => {

t.test('filterLog keeps error instance', async t => {
const result = filterLog(logData, [])
t.equals(logData.data1.error, result.data1.error)
t.equal(logData.data1.error, result.data1.error)
})

const logData2 = Object.assign({
Expand Down

0 comments on commit 3ecbfb1

Please sign in to comment.