Skip to content

fix(web): fix jest-dom matchers not extending vitest expect in test setup#902

Open
xvillarroel wants to merge 1 commit intoComposioHQ:mainfrom
xvillarroel:feat/issue-1
Open

fix(web): fix jest-dom matchers not extending vitest expect in test setup#902
xvillarroel wants to merge 1 commit intoComposioHQ:mainfrom
xvillarroel:feat/issue-1

Conversation

@xvillarroel
Copy link
Copy Markdown

Summary

  • Fixes 83 failing component tests in the web package that used toBeInTheDocument, toHaveAttribute, toHaveClass, and other jest-dom matchers
  • Root cause: import "@testing-library/jest-dom/vitest" was not reliably extending vitest's expect object (the ESM side-effect module resolved to [Module: null prototype] {})
  • Fix: explicitly import matchers from @testing-library/jest-dom/matchers and call expect.extend(matchers) directly — the documented approach for vitest 2.x

Test plan

  • pnpm --filter @composio/ao-web test — all 513 tests pass (previously 83 failures)
  • pnpm typecheck — passes
  • pnpm build — passes

Closes #1

🤖 Generated with Claude Code

The setup file was using `import "@testing-library/jest-dom/vitest"` but
the vitest subpath's ESM side-effect was not reliably extending vitest's
expect object (the module exports `[Module: null prototype] {}`).

Switch to explicitly importing the matchers and calling `expect.extend()`
directly, which is the documented and reliable approach for vitest 2.x.
This fixes all 83 failing component tests that used toBeInTheDocument,
toHaveAttribute, toHaveClass, etc.

Closes ComposioHQ#1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant