Skip to content

Commit

Permalink
100% code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Nov 6, 2018
1 parent f64f638 commit 5dc440b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/broken-pipe.js → test/broken-pipe.test.js
Expand Up @@ -4,6 +4,7 @@ const t = require('tap')
const { join } = require('path')
const { fork } = require('child_process')
const { once } = require('./helper')
const pino = require('..')

function test (file) {
file = join('fixtures', 'broken-pipe', file)
Expand All @@ -23,3 +24,19 @@ t.jobs = 42
test('basic.js')
test('destination.js')
test('extreme.js')

t.test('let error pass through', ({ is, plan }) => {
plan(3)
const stream = pino.destination()

// side effect of the pino constructor is that it will set an
// event handler for error
pino(stream)

process.nextTick(() => stream.emit('error', new Error('kaboom')))
process.nextTick(() => stream.emit('error', new Error('kaboom')))

stream.on('error', (err) => {
is(err.message, 'kaboom')
})
})

0 comments on commit 5dc440b

Please sign in to comment.