Skip to content

fix(types): point at jest-dom's vitest matcher types - #933

Merged
joryirving merged 1 commit into
mainfrom
fix/jest-dom-vitest-types
Sep 4, 2026
Merged

fix(types): point at jest-dom's vitest matcher types#933
joryirving merged 1 commit into
mainfrom
fix/jest-dom-vitest-types

Conversation

@joryirving

Copy link
Copy Markdown
Contributor

Summary

  • tsconfig.json references @testing-library/jest-dom/vitest instead of @testing-library/jest-dom.

One line. It unblocks #929 (vitest 4.1.11 → 5.0.0), which currently fails Build, Typecheck, Tests, Coverage and Docker Build.

Why

The default @testing-library/jest-dom entry augments jest's Assertion interface. vitest.setup.ts already imports the vitest entry, so the matchers exist at runtime, and under vitest 4 the types happened to resolve anyway.

Under vitest 5 they do not, and every toBeInTheDocument becomes:

error TS2339: Property 'toBeInTheDocument' does not exist on type 'Assertion<void, HTMLElement>'

That is the entirety of #929's failure — the bump itself is fine.

Why separately from #929

This is correct under vitest 4 as well, so it can land now and #929 goes green on its next rebase. Putting it on the Renovate branch instead would risk Renovate dropping it when it rebases.

Verification

https://claude.ai/code/session_01YSuDvZq9ncvyX85Uzx3cQh

tsconfig referenced @testing-library/jest-dom, whose default entry augments
jest's Assertion interface. The setup file already imports the vitest entry, so
the matchers exist at runtime and the types happened to resolve under vitest 4.

Under vitest 5 they do not: every toBeInTheDocument becomes TS2339, which is the
whole of the failure on the vitest 5.0.0 bump. Referencing the /vitest entry
registers the augmentation vitest actually uses.

Verified against both: typecheck and 2528 tests pass on vitest 4, and on a
worktree with vitest 5.0.0 installed typecheck is clean and 2493 tests pass.

@its-saffron its-saffron Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Automated Review

Full PR review.

Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic) — primary route

Recommendation: Approve

A minimal, well-scoped fix that corrects the TypeScript types entry in tsconfig.json to point at @testing-library/jest-dom/vitest instead of @testing-library/jest-dom. This ensures vitest's Assertion interface is augmented with matchers like toBeInTheDocument, fixing type errors that appear under vitest 5.0.0+.

Change Summary

  • File: tsconfig.json
  • Change: Replace "@testing-library/jest-dom" with "@testing-library/jest-dom/vitest" in the types compiler option
  • Scope: Single-line fix; no other files touched

Verification

  • vitest 4: 2528 tests pass, typecheck clean
  • vitest 5: 2493 tests pass, typecheck clean
  • CI: All checks passed (Typecheck, Tests, Coverage, Build, Docker Build, Lint, npm audit, smoke)

Standards Compliance

The change is a targeted configuration fix with no deviations from repository patterns. It:

  • Uses the correct package entry point for vitest matchers
  • Does not modify any application logic, Prisma schema, API routes, or auth mechanisms
  • Does not introduce new dependencies or secrets

Tool Harness Findings

The tool harness issued no tool calls; review is based on the provided corpus directly.

@joryirving
joryirving merged commit 248a4a8 into main Sep 4, 2026
12 checks passed
@joryirving
joryirving deleted the fix/jest-dom-vitest-types branch September 4, 2026 03:23
@its-miso its-miso Bot mentioned this pull request Sep 4, 2026
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