Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: add test for autoDestroy in stream
PR-URL: #24127
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
  • Loading branch information
watilde committed Nov 12, 2018
commit 4ac6dedd6b843d42bf18f3efbcd390384b080103
28 changes: 28 additions & 0 deletions test/parallel/test-stream-auto-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,31 @@ const assert = require('assert');
assert(finished);
}));
}

{
const r = new stream.Readable({
read() {
r2.emit('error', new Error('fail'));
Comment thread
watilde marked this conversation as resolved.
Outdated
}
});
const r2 = new stream.Readable({
autoDestroy: true,
destroy: common.mustCall((err, cb) => cb())
});

r.pipe(r2);
}

{
const r = new stream.Readable({
read() {
w.emit('error', new Error('fail'));
Comment thread
watilde marked this conversation as resolved.
Outdated
}
});
const w = new stream.Writable({
autoDestroy: true,
destroy: common.mustCall((err, cb) => cb())
});

r.pipe(w);
}