test: cover Writable.toWeb() queuing strategy size - #65695
Open
dobbydobap wants to merge 1 commit into
Open
Conversation
The size function added to the non-object-mode queuing strategy in ca406b2 had no test, so desiredSize could go back to counting every chunk as 1 without anything failing. Cover both branches: byte length for non-object mode, one per chunk for object mode. Refs: nodejs#62986 Refs: nodejs#56269 Signed-off-by: dobbydobap <varshitha.kolupuri@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65695 +/- ##
=======================================
Coverage 90.06% 90.06%
=======================================
Files 754 754
Lines 256395 256395
Branches 48500 48494 -6
=======================================
+ Hits 230922 230933 +11
+ Misses 16574 16572 -2
+ Partials 8899 8890 -9 🚀 New features to boost your workflow:
|
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.
Writable.toWeb()sizes queued chunks with asize()function fornon-object-mode streams, added in ca406b2 (#62986, fixing #56269), so that
desiredSizereflects byte length rather than counting each chunk as 1. Thatlanded without a test, and nothing else covers it:
test-webstreams-adapters-writable-buffer-sources.jsonly checks chunkconversion, there is a
readable-strategy-optiontest but no writableequivalent, and nothing in
test/parallelcombinesWritable.toWebwithdesiredSize.This covers both branches of the strategy: byte length in non-object mode, one
per chunk in object mode.
Verified in both directions. On
v24.18.0, which predates the fix, thenon-object-mode case fails with
99 !== 97while the object-mode case stillpasses, so the test would actually catch a regression instead of passing
regardless. On a
mainbuild (v27.0.0-nightly20260831) both pass, includingthrough
tools/test.py.