From f01682392910b0e9dabfa5016f9ed2771a9e0e50 Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Sat, 21 Sep 2019 15:20:56 -0400 Subject: [PATCH] stream: add test for multiple .push(null) PR-URL: https://github.com/nodejs/node/pull/29645 Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat Reviewed-By: Yongsheng Zhang Reviewed-By: Ruben Bridgewater --- test/parallel/test-stream-readable-ended.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/parallel/test-stream-readable-ended.js b/test/parallel/test-stream-readable-ended.js index a224c68f041d10..f504330cb165fc 100644 --- a/test/parallel/test-stream-readable-ended.js +++ b/test/parallel/test-stream-readable-ended.js @@ -31,3 +31,16 @@ const assert = require('assert'); assert.strictEqual(readable.readableEnded, false); })); } + +// Verifies no `error` triggered on multiple .push(null) invocations +{ + const readable = new Readable(); + + readable.on('readable', () => { readable.read(); }); + readable.on('error', common.mustNotCall()); + readable.on('end', common.mustCall()); + + readable.push('a'); + readable.push(null); + readable.push(null); +}