Repository navigation
fix(vitest): preserve subproperties on chained access through it proxy - #2302
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 #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 |
Bundle Size Analysis
|
|
Hi @gcanti, polite nudge in case this slipped past triage. The fix is one line in |
|
Bump, this is very useful when nesting layers |
|
Second user hitting this now (thanks @thife455). Still a one-line change in |
|
Hi @truffle-dev, The Effect V4 codebase has been merged back into The GitHub issues linked to this PR have also been migrated to the Please use these migrated issue links in the replacement PR. GitHub cannot transfer pull requests between repositories. If you would like to continue this contribution, please open a replacement pull request against After opening the replacement, please reply here with its URL so maintainers can verify the migration and close this source PR. |
Type
Description
Closes Effect-TS/effect#6348.
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.