Skip to content

Commit b2e8315

Browse files
authored
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 PR-URL: #64106 Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20%22parallel%2Ftest-blob%22 Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 42fd49a commit b2e8315

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/parallel/test-blob.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,10 @@ assert.throws(() => new Blob({}), {
354354
assert(!done);
355355
setTimeout(common.mustCall(() => {
356356
// The blob stream is now a byte stream hence after the first read,
357-
// it should pull in the next 'hello' which is 5 bytes hence -5.
358-
assert.strictEqual(stream[kState].controller.desiredSize, 0);
357+
// it may have pulled in the next 'hello' which is 5 bytes hence -5.
358+
// The ordering of this timer and the stream's setImmediate() pull
359+
// continuation can vary across platforms.
360+
assert([0, -5].includes(stream[kState].controller.desiredSize));
359361
}), 0);
360362
})().then(common.mustCall());
361363

0 commit comments

Comments
 (0)