diff --git a/index.js b/index.js index 2067227..c086fe3 100644 --- a/index.js +++ b/index.js @@ -744,7 +744,6 @@ class Readable extends Stream { resume () { this._duplexState |= READ_RESUMED_READ_AHEAD - this._readableState.flowed = true this._readableState.updateNextTick() return this } diff --git a/test/readable.js b/test/readable.js index 843a0c4..4139f18 100644 --- a/test/readable.js +++ b/test/readable.js @@ -404,16 +404,26 @@ test('setEncoding empty string', async function (t) { }) test('is disturbed', function (t) { - const r = new Readable() + let r = new Readable() t.is(Readable.isDisturbed(r), false) r.push('hello') t.is(Readable.isDisturbed(r), false) r.resume() - t.is(Readable.isDisturbed(r), true) + t.is(Readable.isDisturbed(r), false) r.pause() + t.is(Readable.isDisturbed(r), false) + + r.read() + t.is(Readable.isDisturbed(r), true) + + r = new Readable() + r.push('hello') + t.is(Readable.isDisturbed(r), false) + + r.on('data', () => {}) t.is(Readable.isDisturbed(r), true) })