Skip to content

Commit

Permalink
Upgrade standard to v14
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicdoe committed Sep 14, 2019
1 parent 88b86bd commit ecdee19
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function bindings () {
const chindings = this[chindingsSym]
var chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac"
var bindingsFromJson = JSON.parse(chindingsJson)
delete bindingsFromJson['pid']
delete bindingsFromJson['hostname']
delete bindingsFromJson.pid
delete bindingsFromJson.hostname
return bindingsFromJson
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"qodaa": "^1.0.1",
"snazzy": "^8.0.0",
"split2": "^3.1.1",
"standard": "^13.1.0",
"standard": "^14.2.0",
"steed": "^1.1.3",
"tap": "^12.6.0",
"tape": "^4.10.1",
Expand Down
25 changes: 17 additions & 8 deletions test/browser-serializers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ test('serializers override values', ({ end, is }) => {
})

test('without the serialize option, serializers do not override values', ({ end, is }) => {
const parent = pino({ serializers: parentSerializers,
const parent = pino({
serializers: parentSerializers,
browser: {
write (o) {
is(o.test, 'test')
Expand Down Expand Up @@ -164,12 +165,14 @@ if (process.title !== 'browser') {

console.error = consoleError

logger.child({ aBinding: 'test',
logger.child({
aBinding: 'test',
serializers: {
key: () => 'serialized',
key2: () => 'serialized2',
key3: () => 'serialized3'
} }).fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' })
}
}).fatal({ key: 'test' }, { key2: 'test' }, 'str should skip', [{ foo: 'array should skip' }], { key3: 'test' })
end()
})

Expand Down Expand Up @@ -204,17 +207,20 @@ if (process.title !== 'browser') {

console.error = consoleError

logger.child({ key: 'test',
logger.child({
key: 'test',
serializers: {
key: () => 'serialized'
} }).fatal({ test: 'test' })
}
}).fatal({ test: 'test' })
end()
})
}

test('child does not overwrite parent serializers', ({ end, is }) => {
var c = 0
const parent = pino({ serializers: parentSerializers,
const parent = pino({
serializers: parentSerializers,
browser: {
serialize: true,
write (o) {
Expand All @@ -224,15 +230,18 @@ test('child does not overwrite parent serializers', ({ end, is }) => {
is(o.test, 'child')
end()
}
} } })
}
}
})
const child = parent.child({ serializers: childSerializers })

parent.fatal({ test: 'test' })
child.fatal({ test: 'test' })
})

test('children inherit parent serializers', ({ end, is }) => {
const parent = pino({ serializers: parentSerializers,
const parent = pino({
serializers: parentSerializers,
browser: {
serialize: true,
write (o) {
Expand Down
8 changes: 5 additions & 3 deletions test/custom-levels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ test('throws when useOnlyCustomLevels is set true without customLevels', async (
})

test('custom level on one instance does not affect other instances', async ({ is }) => {
pino({ customLevels: {
foo: 37
} })
pino({
customLevels: {
foo: 37
}
})
is(typeof pino().foo, 'undefined')
})

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/pretty/custom-time-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Date.now = function () { return 1459875739796 }
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
var pino = require(require.resolve('./../../../'))
var log = pino({
timestamp: () => `,"custom-time-label":"test"`,
timestamp: () => ',"custom-time-label":"test"',
prettyPrint: true
})
log.info('h')
2 changes: 1 addition & 1 deletion test/fixtures/pretty/custom-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Date.now = function () { return 1459875739796 }
require('os').hostname = function () { return 'abcdefghijklmnopqr' }
var pino = require(require.resolve('./../../../'))
var log = pino({
timestamp: () => `,"time":"test"`,
timestamp: () => ',"time":"test"',
prettyPrint: true
})
log.info('h')
2 changes: 1 addition & 1 deletion test/levels.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ test('throws when creating a default value that does not exist in logger levels'
useOnlyCustomLevels: true
})
} catch ({ message }) {
is(message, `default level:info must be included in custom levels`)
is(message, 'default level:info must be included in custom levels')
}
})

Expand Down
2 changes: 1 addition & 1 deletion test/pretty.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test('throws when prettyPrint is true but pino-pretty module is not installed',
// error is to simulate it:
const prettyFactory = require('pino-pretty')
require.cache[require.resolve('pino-pretty')].exports = () => {
throw Error(`Cannot find module 'pino-pretty'`)
throw Error('Cannot find module \'pino-pretty\'')
}
throws(() => pino({ prettyPrint: true }))
try { pino({ prettyPrint: true }) } catch ({ message }) {
Expand Down

0 comments on commit ecdee19

Please sign in to comment.