We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0af4317 commit 0996479Copy full SHA for 0996479
test/parallel/test-stream-pipe-needDrain.js
@@ -5,12 +5,13 @@ const assert = require('assert');
5
const Readable = require('_stream_readable');
6
const Writable = require('_stream_writable');
7
8
-// Pipe should not continue writing if writable needs drain.
+// Pipe should pause temporarily if writable needs drain.
9
{
10
const w = new Writable({
11
write(buf, encoding, callback) {
12
-
13
- }
+ process.nextTick(callback);
+ },
14
+ highWaterMark: 1
15
});
16
17
while (w.write('asd'));
@@ -20,10 +21,12 @@ const Writable = require('_stream_writable');
20
21
const r = new Readable({
22
read() {
23
this.push('asd');
24
+ this.push(null);
25
}
26
27
- w.write = common.mustNotCall();
28
+ r.on('pause', common.mustCall());
29
+ r.on('end', common.mustCall());
30
31
r.pipe(w);
32
0 commit comments