Repository navigation
MPT-26825 declare the test globals for ts-jest - #146
Conversation
ts-jest compiles each test file with its own program and drops the automatic `@types/*` inclusion, so whichever suite jest compiles first fails to type-check with "Cannot find name 'jest'". Declaring the globals in the transform's tsconfig makes every suite compile whatever order jest runs them in. The problem is latent in the template rather than new: any suite fails the same way when it is the first one compiled. It surfaces now because jest's default sequencer runs the largest test file first, and the deferrable example makes `useAgreementSync.test.ts` that file.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Set TypeScript transform types frontend/jest.config.cjs |
The transform specifies the jest and @testing-library/jest-dom type packages. It retains esModuleInterop. |
Priority:
Estimated code review effort: 2 (Simple) | ~5 minutes
Merge Risk: 
Minimal · up to 2e403
-
No actionable merge-blocking risk remains.
Pre-merge checks: 
3
-
Full details: Documentation Up To Date
-
Explanation
PASS — The PR changes only
frontend/jest.config.cjsin the Jest/ts-jest test toolchain (lines 10–16). It declares test globals for per-file compilation and does not change application behavior, test scope, developer workflow, deployment configuration, or a public command. The repository testing guide already documents the frontend test commands and scope indocs/testing.md(lines 12–43, 86–98). Under the check's explicit test-only exception, no additional documentation update is required.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
|
@coderabbitai review |
|
|
@coderabbitai full review |
✅ Action performed
|



🤖 AI-generated PR — Please review carefully.
First of three stacked PRs for MPT-26825. This one carries no feature change; it unblocks the other two.
What
ts-jest compiles each test file with its own program and drops the automatic
@types/*inclusion, so whichever suite jest compiles first fails to type-check withTS2304: Cannot find name 'jest'. Declaring the test globals in the transform's tsconfig makes every suite compile whatever order jest runs them in.The problem is latent in the template rather than new: any suite fails the same way when it is the first one compiled, which is reproducible today with
docker compose -f compose.yaml run --rm frontend bash -c "npm ci && npx jest src/shared/hooks/useAgreementId.test.ts"It surfaces now because jest's default sequencer runs the largest test file first, and the deferrable example on top of this stack makes
useAgreementSync.test.tsthat file.Tests
make check-all— 40 backend tests, 42 frontend tests.Closes MPT-26825
ts-jestto include thejestand@testing-library/jest-domtypes.