test: reuse existing PassThrough implementation
PR-URL: https://github.com/nodejs/node/pull/16936 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
803cacd228
commit
6b351e92dc
@ -26,13 +26,6 @@ const stream = require('stream');
|
||||
|
||||
let passed = false;
|
||||
|
||||
class PassThrough extends stream.Transform {
|
||||
_transform(chunk, encoding, done) {
|
||||
this.push(chunk);
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
class TestStream extends stream.Transform {
|
||||
_transform(chunk, encoding, done) {
|
||||
if (!passed) {
|
||||
@ -43,8 +36,8 @@ class TestStream extends stream.Transform {
|
||||
}
|
||||
}
|
||||
|
||||
const s1 = new PassThrough();
|
||||
const s2 = new PassThrough();
|
||||
const s1 = new stream.PassThrough();
|
||||
const s2 = new stream.PassThrough();
|
||||
const s3 = new TestStream();
|
||||
s1.pipe(s3);
|
||||
// Don't let s2 auto close which may close s3
|
||||
|
Loading…
x
Reference in New Issue
Block a user