Skip to content

Commit

Permalink
fix: work around bug in node that makes writable test fail
Browse files Browse the repository at this point in the history
Exiting an async iterator in a pipline early causes a `ERR_STREAM_PREMATURE_CLOSE`
to be thrown.

This should be fixed in a future node release: nodejs/node#23890
  • Loading branch information
achingbrain committed Jul 2, 2020
1 parent 3edada6 commit 8964610
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/helpers/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const { Writable, pipeline } = require('stream')
function pipe (...streams) {
return new Promise((resolve, reject) => {
pipeline(...streams, err => {
if (err) return reject(err)
// work around bug in node to make 'should end mid stream' test pass - https://github.com/nodejs/node/issues/23890
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') return reject(err)
resolve()
})
})
Expand Down

0 comments on commit 8964610

Please sign in to comment.