From b3f163511efe6e86cff61958ea110958671c8255 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Tue, 23 Jun 2026 19:38:50 -0700 Subject: [PATCH] test: make blob desiredSize assertion robust The blob stream pull continuation runs with setImmediate(), while the test checks desiredSize from a timer. Depending on platform scheduling, the stream may or may not have queued the next 5-byte chunk yet. Accept both valid intermediate states to avoid flaky failures. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5 --- test/parallel/test-blob.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-blob.js b/test/parallel/test-blob.js index 19ca24b0319f13..9ec2a3c04079a7 100644 --- a/test/parallel/test-blob.js +++ b/test/parallel/test-blob.js @@ -354,8 +354,10 @@ assert.throws(() => new Blob({}), { assert(!done); setTimeout(common.mustCall(() => { // The blob stream is now a byte stream hence after the first read, - // it should pull in the next 'hello' which is 5 bytes hence -5. - assert.strictEqual(stream[kState].controller.desiredSize, 0); + // it may have pulled in the next 'hello' which is 5 bytes hence -5. + // The ordering of this timer and the stream's setImmediate() pull + // continuation can vary across platforms. + assert([0, -5].includes(stream[kState].controller.desiredSize)); }), 0); })().then(common.mustCall());