diff options
author | Matteo Collina <hello@matteocollina.com> | 2018-08-22 10:46:50 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2018-08-24 11:14:44 +0200 |
commit | 656da16e1c6c76ee1b96745bc8a92750ed4435d5 (patch) | |
tree | cedfffe23fc5bfc7e3b55031f2593b621090dc7e /test/parallel/test-stream-pipeline.js | |
parent | 57d98bc7323b4f72631074cd68a9306f33066bb8 (diff) | |
download | android-node-v8-656da16e1c6c76ee1b96745bc8a92750ed4435d5.tar.gz android-node-v8-656da16e1c6c76ee1b96745bc8a92750ed4435d5.tar.bz2 android-node-v8-656da16e1c6c76ee1b96745bc8a92750ed4435d5.zip |
test,stream: fix pipeline test so it runs well on Windows in older nodes
This test is ported automatically in readable-stream, and it fails there
on Windows and older Node.js versions because of some bad interactions
between the code and the event loop on Windows.
See: https://github.com/nodejs/readable-stream/issues/353
PR-URL: https://github.com/nodejs/node/pull/22456
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-stream-pipeline.js')
-rw-r--r-- | test/parallel/test-stream-pipeline.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index 6f9bca811f..84fb01fe0d 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -165,8 +165,13 @@ const { promisify } = require('util'); { const server = http.createServer((req, res) => { + let sent = false; const rs = new Readable({ read() { + if (sent) { + return; + } + sent = true; rs.push('hello'); }, destroy: common.mustCall((err, cb) => { @@ -195,8 +200,12 @@ const { promisify } = require('util'); { const server = http.createServer((req, res) => { + let sent = 0; const rs = new Readable({ read() { + if (sent++ > 10) { + return; + } rs.push('hello'); }, destroy: common.mustCall((err, cb) => { @@ -242,8 +251,12 @@ const { promisify } = require('util'); port: server.address().port }); + let sent = 0; const rs = new Readable({ read() { + if (sent++ > 10) { + return; + } rs.push('hello'); } }); |