Skip to content

web: upgrade Jest to v30#9253

Closed
kevinortiz43 wants to merge 2 commits into
developfrom
web/chore/jest-30
Closed

web: upgrade Jest to v30#9253
kevinortiz43 wants to merge 2 commits into
developfrom
web/chore/jest-30

Conversation

@kevinortiz43

Copy link
Copy Markdown
Contributor

Upgrades app/web from Jest 29 to Jest 30, following the official Jest 30 migration guide referenced in the issue. Web-only — mobile's Jest is pinned by the Expo SDK and is out of scope.

Done as 2 commits: first the backward-compatible test refactors (green on Jest 29, so it's a clean bisect point), then the version bump and its fallout.

  • Matcher aliases → canonical names (removed in v30, per the guide): toBeCalled/toBeCalledTimes/toBeCalledWithtoHaveBeenCalled* across 12 test files (23 sites). No toThrowError sites existed.
  • jest.SpyInstancejest.Spied<…> (type removed in v30) in features/analytics/provider.test.tsx.
  • Bumped jest ^29.7.0^30.4.2, jest-environment-jsdom ^29.7.0^30.4.1, @types/jest ^29.5.14^30.0.0. babel-jest/jest-junit already compatible.
  • JSDOM 21→26 fallout (bundled with jest-environment-jsdom 30): JSDOM 26 makes global window/window.location non-configurable, so two tests that redefined them via Object.defineProperty now threw. Fixed by removing a dead window-restore in PushNotificationSettings.test.tsx and switching provider.test.tsx to history.pushState (JSDOM's supported navigation API). Also jest.config.ts: next/jestnext/jest.js for v30's stricter ESM resolution.

Closes #6978

Testing

  • tsc --noEmit clean (verified the guide's stricter toHaveBeenCalledWith type inference surfaced no new errors).
  • Full yarn test suite on Jest 30: 881 pass / 3 skip; the only failures are two pre-existing parallel-load flakes (MarkdownInput — file untouched here; EditProfilePage — passes with --runInBand), which fail identically on develop. Zero new regressions.
  • jest-junit still emits valid JUnit XML for CI.
  • No snapshots in the repo, so the v30 serializer changes don't apply.

Web frontend checklist

  • There are no console warnings when running the app
  • Added tests where relevant (N/A — test-infra upgrade; existing suite is the coverage)
  • Clicked around my changes running locally and it works (full Jest suite is the surface here; no runtime/UI change)
  • Checked Desktop, Mobile and Tablet screen sizes (N/A — no UI change)

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

kevinortiz43 and others added 2 commits July 9, 2026 03:47
Jest 30 removes the alias matchers; switch to the canonical spellings
now so this lands and stays green on jest 29 before the version bump.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bump jest, jest-environment-jsdom, and @types/jest to v30 (see
https://jestjs.io/docs/upgrading-to-jest30). Fix the resulting fallout:
jest.config.ts needs the explicit next/jest.js extension under jest 30's
stricter TS config resolution, and two test files redefined `window`/
`window.location` in setup/teardown, which jsdom 26 now makes
non-configurable — replaced with window.history.pushState and dropped
the no-op window restore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CouchersBot

CouchersBot commented Jul 9, 2026

Copy link
Copy Markdown
Member

Mobile

Install the Dev Tool (iOS via TestFlight, iOS Simulator, or Android .apk) here.

Scan the QR with your phone camera, or tap Open in Dev Tool on the device, to open this branch in the installed Dev Tool dev client.

    iOS         Android    
    QR to open the iOS build         QR to open the Android build    
    Open in Dev Tool         Open in Dev Tool    
Deep links

iOS

couchers-devtool://expo-development-client/?url=https%3A%2F%2F6e47331e--ota.preview.couchershq.org%2Fios%2Fmanifest

Android

couchers-devtool://expo-development-client/?url=https%3A%2F%2F6e47331e--ota.preview.couchershq.org%2Fandroid%2Fmanifest

Web (Vercel)

View the Vercel web preview for this branch.

Backend

Schema Schema diff Sample emails

Other

Protos Backend coverage Web coverage

@nabramow

Copy link
Copy Markdown
Member

Hey @kevinortiz43 - @darrenvong already did this ticket before you in #9252 FYI. I've approved that one so probably best to close this one.

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.

Upgrade jest to v30

3 participants