diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index c7b356ed4421b0..46afe5f33dee91 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -488,9 +488,9 @@ function onEofChunk(stream, state) { } state.ended = true; - if (state.sync && state.length) { - // if we are sync and have data in the buffer, wait until next tick - // to emit the data. otherwise we risk emitting data in the flow() + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() // the readable code triggers during a read() call emitReadable(stream); } else { diff --git a/test/parallel/test-stream-readable-object-multi-push-async.js b/test/parallel/test-stream-readable-object-multi-push-async.js index 4babfd12a27084..17c84c7310e053 100644 --- a/test/parallel/test-stream-readable-object-multi-push-async.js +++ b/test/parallel/test-stream-readable-object-multi-push-async.js @@ -160,7 +160,7 @@ const BATCH = 10; }); readable.on('end', common.mustCall(() => { - assert.strictEqual(nextTickPassed, false); + assert.strictEqual(nextTickPassed, true); })); }