Skip to content

Instantly share code, notes, and snippets.

@HomerSp
Created December 18, 2020 15:06
Show Gist options
  • Save HomerSp/bea83eb0dcbd0aea3b2689c2cd91bb38 to your computer and use it in GitHub Desktop.
Save HomerSp/bea83eb0dcbd0aea3b2689c2cd91bb38 to your computer and use it in GitHub Desktop.
diff --git a/test/parallel/test-stream-pipe-needDrain.js b/test/parallel/test-stream-pipe-needDrain.js
index 7e8f5f6f47..be12b94af8 100644
--- a/test/parallel/test-stream-pipe-needDrain.js
+++ b/test/parallel/test-stream-pipe-needDrain.js
@@ -5,12 +5,13 @@ const assert = require('assert');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
-// Pipe should not continue writing if writable needs drain.
+// Pipe should pause temporarily if writable needs drain.
{
const w = new Writable({
write(buf, encoding, callback) {
-
- }
+ process.nextTick(callback);
+ },
+ highWaterMark: 1
});
while (w.write('asd'));
@@ -20,10 +21,11 @@ const Writable = require('_stream_writable');
const r = new Readable({
read() {
this.push('asd');
+ this.push(null);
}
});
- w.write = common.mustNotCall();
-
+ r.on('pause', common.mustCall());
+ r.on('end', common.mustCall());
r.pipe(w);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment