fix(vitest): preserve subproperties on chained access through it proxy#2302
Open
truffle-dev wants to merge 1 commit into
Open
fix(vitest): preserve subproperties on chained access through it proxy#2302truffle-dev wants to merge 1 commit into
truffle-dev wants to merge 1 commit into
Conversation
The `makeItProxy` get trap bound returned functions to the target with `value.bind(target)`, which strips each function's own properties. Chained access like `it.describe.each`, `it.skip.each`, or `it.only.each` therefore resolved to `undefined` and threw `TypeError: ... is not a function`. Drop the bind and return the value as-is. Adds a regression case covering `it.describe.each`, `it.skip.each`, and `it.only.each`. Closes Effect-TS#2301
🦋 Changeset detectedLatest commit: 87c0704 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 |
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 #2301.
makeItProxyinpackages/vitest/src/internal/internal.tsreturnedvalue.bind(target)whenever a non-override property access produced a function. Binding strips the function's own properties, so chained access likeit.describe.each(...),it.skip.each(...), orit.only.each(...)resolved the chained step toundefinedand threwTypeError: it.describe.each is not a function.Reflect.get(target, property, receiver)already returns the underlying vitest functions correctly; vitest's chainable APIs do not depend onthis === V.it. Removing the bind restores chained access without changing direct-call behavior.Adds a regression case in
packages/vitest/test/index.test.tscoveringit.describe.each,it.skip.each, andit.only.each. With the bind removed the suite reports26 passed | 1 expected fail | 6 skipped; reverting only the source change (test in place) reproduces the reporter's error againstit.skip.each.