fix(browser): preserve undefined command arguments - #10923
Open
nguyennvk wants to merge 4 commits into
Open
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
sheremet-va
requested changes
Aug 12, 2026
Arguments contains undefined can be missed pushing other arguments forward. close vitest-dev#10864
nguyennvk
force-pushed
the
fix/unparsed-undefined
branch
from
August 12, 2026 07:43
a2ac921 to
ae2f72f
Compare
sheremet-va
reviewed
Aug 12, 2026
| } | ||
| }, | ||
| async triggerCommand(sessionId, command, testPath, payload) { | ||
| payload = payload.map(value => value === null ? undefined : value) |
Member
There was a problem hiding this comment.
This is not where the fix should be. We should fix the serialisation instead (serialise/deserialise that we pass to birpc)
Author
Member
There was a problem hiding this comment.
Yes, both stringify and parse accept a custom serializer. We could maybe provide a "hidden" value like "__VITEST_UNDEFINED__" to transform into undefined? Although I thought that flatted already supports undefined 🤔
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.

Description
Custom browser commands CANNOT read
undefinedarguments crossing the browser → Node RPC boundary. The entry was dropped from the argument array, shifting later arguments left. Example:Cause
Line 136 in packages/browser/src/client/tester/tester-utils.ts
This line filter out undefined values.
Fix
Remove that line and add a mapping in packages/browser/src/node/rpc.ts
to map null to undefined to match the test case created by @AriPerkkio
Tests
Includes the failing test from #10865 (authored by @AriPerkkio), which
now passes.
Resolves #10864
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.