test: fix Node 26 flake in 'group parts with same name to an array' - #646
Merged
Merged
Conversation
The test asserted the number of times the streaming loop observed a grouped array via conditional t.assert.ok() calls, so its plan (15) depended on when busboy turned a repeated field name into an array. Under Node 26 the timing differs and one extra assertion fires, failing with 'plan expected 15 assertions but received 16'. Track the grouped-array observation in flags and assert the result once, deterministically, after the loop. The per-part t.assert.ok(part) count (6 parts) and the response handler assertions are unchanged; plan is now 10.
Tony133
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a deterministic test failure on Node 26 (CI
Test (26, ubuntu-latest)):This is unrelated to any behaviour change; it is a test-only flake. The docs PR (#645) shows the same failure with no runtime changes.
Root cause
The test used
t.plan(15)and asserted the number of times the streaming loop observed a grouped array via conditionalt.assert.ok()calls:How many times these fire depends on when busboy turns a repeated field name into an array, which is timing-sensitive. Under Node 26 the timing shifts and one extra assertion fires, so the plan of 15 is exceeded (16 received).
Fix
Track whether the grouping was observed in flags during the loop, then assert the result once and deterministically after the loop:
The per-part
t.assert.ok(part)count (6 parts) and the two response-handler assertions are unchanged; the plan is now10and no longer depends on streaming timing.Verification
node --test test/multipart.test.js— 13/13 passnpm run test:unit— 92/92 pass, 100% coverage maintainednpm run lint— clean