summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-readable-destroy.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2017-05-22 18:03:55 +0200
committerMatteo Collina <hello@matteocollina.com>2017-05-24 11:21:03 +0200
commitccd3eadbd7dae3a23d43bf490fa9d3019324370e (patch)
treea78c04da8eeb777baba4a29c25c3516a40c9220c /test/parallel/test-stream-readable-destroy.js
parent6af72d4b037eba38d94395f57a03a498a2efef09 (diff)
downloadandroid-node-v8-ccd3eadbd7dae3a23d43bf490fa9d3019324370e.tar.gz
android-node-v8-ccd3eadbd7dae3a23d43bf490fa9d3019324370e.tar.bz2
android-node-v8-ccd3eadbd7dae3a23d43bf490fa9d3019324370e.zip
stream: fix destroy(err, cb) regression
Fixed a regression that caused the callback passed to destroy() to not be called if the stream was already destroyed. This caused a regression on the ws module in CITGM introduced by https://github.com/nodejs/node/pull/12925. PR-URL: https://github.com/nodejs/node/pull/13156 Fixes: https://github.com/websockets/ws/issues/1118 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/parallel/test-stream-readable-destroy.js')
-rw-r--r--test/parallel/test-stream-readable-destroy.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js
index 800b6be086..def20d26c3 100644
--- a/test/parallel/test-stream-readable-destroy.js
+++ b/test/parallel/test-stream-readable-destroy.js
@@ -160,3 +160,17 @@ const { inherits } = require('util');
new MyReadable();
}
+
+{
+ // destroy and destroy callback
+ const read = new Readable({
+ read() {}
+ });
+ read.resume();
+
+ const expected = new Error('kaboom');
+
+ read.destroy(expected, common.mustCall(function(err) {
+ assert.strictEqual(expected, err);
+ }));
+}