forked from pinojs/pino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pinojs#377 from pinojs/std-serializer-api-typo
std serializers api typo + deprecation unit tests
- Loading branch information
Showing
3 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict' | ||
|
||
var test = require('tap').test | ||
var pino = require('../') | ||
var sink = require('./helper').sink | ||
|
||
test('opts.slowtime', function (t) { | ||
if (typeof process.emitWarning === 'function') { | ||
process.once('warning', (msg) => { | ||
t.is(/`slowtime` is deprecated/.test(msg), true) | ||
t.end() | ||
}) | ||
} else { | ||
const write = process.stderr.write | ||
process.stderr.write = (msg) => { | ||
t.is(/`slowtime` is deprecated/.test(msg), true) | ||
process.nextTick(t.end) | ||
process.stderr.write = write | ||
} | ||
} | ||
|
||
var instance = pino({slowtime: true}, | ||
sink(function (chunk, enc, cb) { | ||
t.ok(Date.parse(chunk.time) <= new Date(), 'time is greater than Date.now()') | ||
})) | ||
|
||
instance.info('hello world') | ||
}) | ||
|
||
test('pino.stdSerializers.wrapRespnonseSerializer', function (t) { | ||
if (typeof process.emitWarning === 'function') { | ||
process.once('warning', (msg) => { | ||
t.is(/`pino.stdSerializers.wrapRespnonseSerializer` is deprecated/.test(msg), true) | ||
t.end() | ||
}) | ||
} else { | ||
const write = process.stderr.write | ||
process.stderr.write = (msg) => { | ||
t.is(/`pino.stdSerializers.wrapRespnonseSerializer` is deprecated/.test(msg), true) | ||
process.nextTick(t.end) | ||
process.stderr.write = write | ||
} | ||
} | ||
t.is(pino.stdSerializers.wrapRespnonseSerializer, pino.stdSerializers.wrapResponseSerializer) | ||
}) |