Skip to content

fix(vitest): preserve subproperties on chained access through it proxy#2302

Open
truffle-dev wants to merge 1 commit into
Effect-TS:mainfrom
truffle-dev:fix/it-proxy-preserve-subproperties
Open

fix(vitest): preserve subproperties on chained access through it proxy#2302
truffle-dev wants to merge 1 commit into
Effect-TS:mainfrom
truffle-dev:fix/it-proxy-preserve-subproperties

Conversation

@truffle-dev
Copy link
Copy Markdown

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Closes #2301.

makeItProxy in packages/vitest/src/internal/internal.ts returned value.bind(target) whenever a non-override property access produced a function. Binding strips the function's own properties, so chained access like it.describe.each(...), it.skip.each(...), or it.only.each(...) resolved the chained step to undefined and threw TypeError: 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 on this === V.it. Removing the bind restores chained access without changing direct-call behavior.

Adds a regression case in packages/vitest/test/index.test.ts covering it.describe.each, it.skip.each, and it.only.each. With the bind removed the suite reports 26 passed | 1 expected fail | 6 skipped; reverting only the source change (test in place) reproduces the reporter's error against it.skip.each.

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-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: 87c0704

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@effect/vitest Patch
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@effect/vitest: it.describe.each is not a function

1 participant