Skip to content

chore(mobile): upgrade @testing-library/react-native to v14 (needs React 19.2) #2000

Description

@ankit-yc

Summary

Upgrade @testing-library/react-native from 13.x to 14.x in apps/mobileAppYC. This is blocked on a React version bump, so it was held back out of the jest 30 chore PR (#1959) rather than landed with it.

Problem / motivation

Dependabot offered v14 inside the grouped testing bump. Taking it made 283 of 456 mobile suites fail.

Two independent blockers:

  1. React version. v14 replaces react-test-renderer with the new test-renderer package, whose react-reconciler requires React 19.2. react-native 0.81 pins React 19.1, so render() returns an unusable object.
  2. Removed queries. v14 drops the UNSAFE_* queries, which these suites currently use.

Holding at ^13.3.3 keeps the other three testing-group bumps (jest 30 and friends) shippable. The cost is that apps/mobileAppYC stays a major behind on its testing library, and dependabot will keep re-offering v14.

Proposed solution

  1. Move react-native to a version that pins React >= 19.2 (or otherwise get React 19.2 into the mobile workspace without breaking RN).
  2. Add test-renderer and drop react-test-renderer plus @types/react-test-renderer.
  3. Migrate every UNSAFE_* query to a supported query.
  4. Bump @testing-library/react-native to 14.x and get all mobile suites green.

Scope

  • apps/mobileAppYC/package.json (@testing-library/react-native, react-test-renderer -> test-renderer, React/RN versions)
  • Mobile test files using UNSAFE_* queries
  • Any test importing react-test-renderer directly - there are currently 17 such files

Out of scope

Current state / where it plugs in

apps/mobileAppYC is on @testing-library/react-native ^13.3.3, react-test-renderer 19.1.0, react-native 0.81.4, React 19.1.0.

Note this overlaps the mobile test-teardown work: 17 files drive react-test-renderer directly, which is the same surface as #1822 and PR #1821. Sequencing matters - doing this before or after that work, not concurrently.

Acceptance criteria

  • @testing-library/react-native on 14.x
  • test-renderer replaces react-test-renderer, and @types/react-test-renderer is gone
  • No UNSAFE_* queries remain in mobile tests
  • All mobile suites pass (456 suites / 7400 tests as of the jest 30 work)
  • React Doctor stays at or above the 95 CI gate

Test plan

Full apps/mobileAppYC Jest suite with TZ=UTC, plus type-check and lint. Run the full suite several times consecutively - this workspace has a known cross-suite flake profile, so a single green run is not sufficient evidence.

Alternatives considered

  • Take v14 now and pin React 19.2 directly. Rejected: it would put the React version out of step with what react-native 0.81 expects.
  • Ignore the major in dependabot config. Hides the work rather than tracking it, and the PR would stop being re-offered.

Dependencies & risks

Additional context

Held back in #1959. Failure signature on the attempted upgrade: render returning an unusable object across 283 of 456 suites.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions