From b76e54da75267f97382e1463c95af1890a163f5c Mon Sep 17 00:00:00 2001 From: Gregor MacLennan Date: Thu, 6 Jul 2023 14:40:59 +0100 Subject: [PATCH] fix: Ignore missing coverage for backpressure We don't yet properly test for back pressure. This was only covered before because a slow state machine in streamx was resulting in backpressure here, but the fixes in https://github.com/mafintosh/streamx/pull/77 resulted in no backpressure, so this line became uncovered by tests --- lib/core-index-stream.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/core-index-stream.js b/lib/core-index-stream.js index 0991a1c..065756a 100644 --- a/lib/core-index-stream.js +++ b/lib/core-index-stream.js @@ -134,6 +134,13 @@ class CoreIndexStream extends Readable { (await this[kPushEntry](index)) || /* istanbul ignore next - TODO: Test when hypercore-next supports a core.clear() method */ didPush + // This is for back-pressure, for which there is not a good test yet. + // The faster streamx state machine in https://github.com/mafintosh/streamx/pull/77 + // caused this stream's read buffer to never fill with the current tests, + // so that this line is currently uncovered by tests. + // TODO: Add a test similar to 'Appends from a replicated core are indexed' in core-index-stream.test.js + // but pipe to a slow stream, to test back-pressure, which should result in coverage of this line. + /* istanbul ignore next */ if (!this.#readBufferAvailable) break } }