Skip to content

Commit

Permalink
add test for sync file open
Browse files Browse the repository at this point in the history
  • Loading branch information
admataz authored and mcollina committed Jul 15, 2020
1 parent 2899c37 commit 6c51921
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,3 +760,14 @@ test('write enormously large buffers sync with utf8 multi-byte split', (t) => {
t.pass('close emitted')
})
})

// for context see this issue https://github.com/pinojs/pino/issues/871
test('file specified by dest path available immediately when options.sync is true', (t) => {
t.plan(3)
const dest = file()
const stream = new SonicBoom({ dest, sync: true })
t.ok(stream.write('hello world\n'))
t.ok(stream.write('something else\n'))
stream.flushSync()
t.pass('file opened and written to without error')
})

0 comments on commit 6c51921

Please sign in to comment.