summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_stream_writable.js2
-rw-r--r--test/parallel/test-stream-inheritance.js5
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
index 6e0eaf45b5..7de77958d5 100644
--- a/lib/_stream_writable.js
+++ b/lib/_stream_writable.js
@@ -179,6 +179,8 @@ if (typeof Symbol === 'function' && Symbol.hasInstance) {
value: function(object) {
if (realHasInstance.call(this, object))
return true;
+ if (this !== Writable)
+ return false;
return object && object._writableState instanceof WritableState;
}
diff --git a/test/parallel/test-stream-inheritance.js b/test/parallel/test-stream-inheritance.js
index 2d9a1e83ef..a687ea9da0 100644
--- a/test/parallel/test-stream-inheritance.js
+++ b/test/parallel/test-stream-inheritance.js
@@ -56,3 +56,8 @@ common.expectsError(
message: 'undefined does not inherit from CustomWritable'
}
);
+
+class OtherCustomWritable extends Writable {}
+
+assert(!(new OtherCustomWritable() instanceof CustomWritable));
+assert(!(new CustomWritable() instanceof OtherCustomWritable));