Skip to content

Commit 7794d4e

Browse files
mcollinatargos
authored andcommitted
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: nodejs/readable-stream#353 PR-URL: #22456 Reviewed-By: Mathias Buus <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e254130 commit 7794d4e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parallel/test-stream-pipeline.js

+13
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,13 @@ const { promisify } = require('util');
165165

166166
{
167167
const server = http.createServer((req, res) => {
168+
let sent = false;
168169
const rs = new Readable({
169170
read() {
171+
if (sent) {
172+
return;
173+
}
174+
sent = true;
170175
rs.push('hello');
171176
},
172177
destroy: common.mustCall((err, cb) => {
@@ -195,8 +200,12 @@ const { promisify } = require('util');
195200

196201
{
197202
const server = http.createServer((req, res) => {
203+
let sent = 0;
198204
const rs = new Readable({
199205
read() {
206+
if (sent++ > 10) {
207+
return;
208+
}
200209
rs.push('hello');
201210
},
202211
destroy: common.mustCall((err, cb) => {
@@ -242,8 +251,12 @@ const { promisify } = require('util');
242251
port: server.address().port
243252
});
244253

254+
let sent = 0;
245255
const rs = new Readable({
246256
read() {
257+
if (sent++ > 10) {
258+
return;
259+
}
247260
rs.push('hello');
248261
}
249262
});

0 commit comments

Comments
 (0)