- Version: all
- Platform: all
- Subsystem: stream
_readableStream and _writableStream in streams are widely used in userland, but the coverage for the state machine is insufficient, as only few properties of those are checked by unit tests.
I propose we add some more tests for the internal properties and state. This is probably a meta-issue, in the sense that we might send multiple PRs to increase the coverage.
Edit: The tests should possibly use only the stream module, rather than fs or net.
$ grep _readableState *
test-https-truncate.js: assert.equal(res._readableState.length, 0);
test-stream-duplex.js:assert(stream._readableState.objectMode);
test-stream-push-order.js: assert.deepStrictEqual(s._readableState.buffer.join(','), '1,2,3,4,5,6');
test-stream-readable-event.js: assert(!r._readableState.reading);
test-stream-readable-event.js: assert(r._readableState.reading);
test-stream-readable-event.js: assert(!r._readableState.reading);
test-stream-readable-flow-recursion.js: assert.equal(stream._readableState.highWaterMark, 8192);
test-stream-readable-flow-recursion.js: assert.equal(stream._readableState.length, 0);
test-stream-transform-split-objectmode.js:assert(parser._readableState.objectMode);
test-stream-transform-split-objectmode.js:assert(parser._readableState.highWaterMark === 16);
test-stream-transform-split-objectmode.js:assert(!serializer._readableState.objectMode);
test-stream-transform-split-objectmode.js:assert(serializer._readableState.highWaterMark === (16 * 1024));
test-stream2-large-read-stall.js:var rs = r._readableState;
test-stream2-push.js: console.error('data', stream._readableState.length);
test-stream2-read-sync-stack.js: if (!(r._readableState.length % 256))
test-stream2-read-sync-stack.js: console.error('readable', r._readableState.length);
test-stream2-transform.js: t.equal(tx._readableState.length, 10);
test-stream2-unpipe-leak.js:console.error(src._readableState);
test-stream2-unpipe-leak.js: src._readableState.buffer.length = 0;
test-stream2-unpipe-leak.js: console.error(src._readableState);
test-stream2-unpipe-leak.js: assert(src._readableState.length >= src._readableState.highWaterMark);
test-stream3-pause-then-read.js: assert(!r._readableState.flowing);
$ grep _writableState *
test-http-pipeline-regr-3508.js: if (size <= req.socket._writableState.highWaterMark) {
test-net-reconnect.js: console.error('CLIENT connected', client._writableState);
test-net-reconnect.js: console.error('CLIENT: calling end', client._writableState);
test-stream-big-packet.js:var big = Buffer.alloc(s1._writableState.highWaterMark + 1, 'x');
test-stream-duplex.js:assert(stream._writableState.objectMode);
test-stream-transform-split-objectmode.js:assert(!parser._writableState.objectMode);
test-stream-transform-split-objectmode.js:assert(parser._writableState.highWaterMark === (16 * 1024));
test-stream-transform-split-objectmode.js:assert(serializer._writableState.objectMode);
test-stream-transform-split-objectmode.js:assert(serializer._writableState.highWaterMark === 16);
test-stream2-transform.js: t.same(tx._writableState.getBuffer().map(function(c) {
test-stream2-writable.js: assert(tw._writableState.length >= 50);
test-zlib-flush-drain.js:const ws = deflater._writableState;
cc @nodejs/streams
_readableStreamand_writableStreamin streams are widely used in userland, but the coverage for the state machine is insufficient, as only few properties of those are checked by unit tests.I propose we add some more tests for the internal properties and state. This is probably a meta-issue, in the sense that we might send multiple PRs to increase the coverage.
Edit: The tests should possibly use only the
streammodule, rather thanfsornet.cc @nodejs/streams