fix(types): point at jest-dom's vitest matcher types - #933
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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 thetypescompiler 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.
Open
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.
Summary
tsconfig.jsonreferences@testing-library/jest-dom/vitestinstead 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-domentry augments jest'sAssertioninterface.vitest.setup.tsalready 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
toBeInTheDocumentbecomes: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
npm ciwith its lockfile —vitest/5.0.0, typecheck clean, 2493 tests pass.https://claude.ai/code/session_01YSuDvZq9ncvyX85Uzx3cQh