Preserve chained vitest helpers like it.describe.each through the it proxy - #6444
Merged
mikearnaldi merged 1 commit intoJul 18, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 88439e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
rvaccone
marked this pull request as ready for review
July 17, 2026 01:29
Contributor
Bundle Size Analysis
|
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.
Type
Description
Closes #6348.
makeItProxyinpackages/vitest/src/internal/internal.tsreturnedvalue.bind(target)for every function property accessed through theitproxy.Function.prototype.bindproduces a fresh function without the original's own properties, and that is exactly where vitest attaches its static helpers (each,skip,only, etc.). As a result, chained access likeit.describe.each(...)orit.skip.each(...)threwTypeError: it.describe.each is not a function.This returns the property as is instead of a bound copy. Removing the bind is safe: vitest's chain functions ignore dynamic
thisand invoke the underlying collector with a context captured in a closure, while the helpers that do readthis(each,for,skipIf,runIf) still resolve correctly because the proxy forwards every lookup it does not override, including vitest's internal context symbol, to the target. Before the proxy was introduced,makeMethodsusedObject.assign(it, overrides)on the vitestitdirectly, so chained helpers worked natively; this restores those semantics. As a side effect, property access no longer allocates a bound function each time.Adds regression tests for
it.describe.each(the reproduction from the issue, with a nestedit.effect) andit.skip.each, both verified to fail against the previous implementation.This supersedes Effect-TS/effect-smol#2302 by @truffle-dev, which proposed this same fix, and Effect-TS/effect-smol#2344 by @SAY-5, both closed in the V4 repository migration. Happy to close this in favor of either author if they would prefer to resubmit their own port.