Skip to content

Commit

Permalink
stream: Duplex forward writableObjectMode
Browse files Browse the repository at this point in the history
Duplex did not properly forward writableObjectMode.

Fixes: #33388
  • Loading branch information
ronag committed May 13, 2020
1 parent b04e884 commit 3326255
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/_stream_duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ ObjectDefineProperties(Duplex.prototype, {
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable'),
writableHighWaterMark:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark'),
writableObjectMode:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode'),
writableBuffer:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer'),
writableLength:
Expand Down
29 changes: 29 additions & 0 deletions test/parallel/test-stream-duplex-props.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

require('../common');
const assert = require('assert');
const { Duplex } = require('stream');

{
const d = new Duplex({
objectMode: true,
highWaterMark: 100
});

assert.strictEqual(d.writableObjectMode, true);
assert.strictEqual(d.writableHighWaterMark, 100);
}

{
const d = new Duplex({
readableObjectMode: false,
readableHighWaterMark: 10,
writableObjectMode: true,
writableHighWaterMark: 100
});

assert.strictEqual(d.writableObjectMode, true);
assert.strictEqual(d.writableHighWaterMark, 100);
assert.strictEqual(d.readableObjectMode, false);
assert.strictEqual(d.readableHighWaterMark, 10);
}

0 comments on commit 3326255

Please sign in to comment.