Nothing on this page matches that. Check the list under the search box for matches on other pages.
Testing
T1MUST test behavior through the UI with React Native Testing Library: query by role, label or text, act with userEvent, assert what the user sees. NEVER test internal state or private functions, and NEVER rely on whole-screen snapshots as the main test.
T2MUST spend tests where bugs cost most: unit tests for pure logic (money math, validation, formatters), functional tests for screens (user events + mocked API), E2E only for critical journeys (sign-in, payment). NEVER chase a coverage percentage.
T3MUST ship every bug fix with a test that fails before the fix, and every new screen with at least one functional test for its success state and its error state (EB5).
T4MUST mock at the network boundary, not the query hooks: render with a real query client (retries off) inside one shared test wrapper.
T5MUST use the Jest preset for the stack: jest-expo in Expo projects, React Native’s preset in bare ones. On React Native Testing Library v14, render, act, renderHook and fireEvent are async: await them (A5).
T6MUST keep tests deterministic: fake timers, no real network, no sleeps or arbitrary waits.
T7SHOULD use Maestro for E2E flows when the level calls for it (table below); in Expo projects it runs as a job in EAS Workflows.
Test writing conventions
Files and names
TW1MUST colocate tests with the code: TransferScreen.test.tsx beside TransferScreen.tsx (or the repo’s __tests__/ convention). Performance tests end in .perf-test.tsx. Maestro flows live in .maestro/, one file per journey (sign-in.yaml, send-transfer.yaml).
TW2MUST name tests by behavior in plain words: describe('TransferScreen'), it('shows an error with a retry button when loading fails'). NEVER it('works') or names that repeat the implementation.
TW3MUST write one behavior per test in Arrange → Act → Assert order. NEVER if or loops inside a test; use it.each for variations.
TW4MUST query in this order: getByRole → getByLabelText → getByText → getByTestId. A testID is the last resort, or for Maestro flows. A screen that is hard to query by role usually has an accessibility bug (C6).
TW5MUST share setup through one test/render.tsx (providers + a fresh query client) and typed factories in test/factories/ (buildTransfer({ status: 'failed' })). NEVER paste large JSON fixtures into tests.
Unit tests
UT1MUST unit-test pure logic: money math, formatters, validation schemas, reducers, and hooks with real logic. Cover the edges with it.each: 0, negative, maximum, rounding, empty input.
UT2NEVER unit-test a component’s internals; components are covered by functional tests.
UT3MUST keep unit tests free of network, timers and native modules, so the whole unit suite stays fast enough to run on every save.
Functional tests
FT1MUST give every screen a functional test (Jest + React Native Testing Library): render it with providers and a mocked API, drive it with userEvent, assert what the user sees. Cover success, error, empty and the main action (submit, retry).
FT2MUST mock only the edges: network responses and native modules (jest-expo mocks the Expo SDK). Keep real components, real hooks and a real query client; use the router’s testing utilities where they exist (A5). In Expo Router that is renderRouter from expo-router/testing-library, which needs React Native Testing Library v14 or later. Route tests NEVER go inside app/, because every file there becomes a route; put them beside the feature screen or in __tests__/.
FT3MUST write Maestro E2E flows for critical journeys only, run against a release-like build, selecting elements by accessibility label or testID. Each flow starts from a clean state and does not depend on another flow.
Tooling
TL1MUST pass on every change: type check (tsc --noEmit), lint, tests, and npx expo-doctor in Expo projects. New projects lint with --max-warnings 0.
TL2MUST format with Prettier, on touched files only (P7).
TL3MUST pin the Node version (.nvmrc or engines) at or above the React Native minimum; React Native 0.84+ needs Node 22.
TL4MUST commit the lockfile and use one package manager. NEVER mix npm, Yarn, pnpm and Bun in one repo.
TL5MUST upgrade React Native or the Expo SDK in its own change, with no feature work mixed in, using the Upgrade Helper or npx expo install --fix.
CI checks
Every check runs on every PR at its level and fails the build on its own; the agent runs the Starter checks locally before reporting done (D1).
Check
Tool
Fails the build when
Level
Types
tsc --noEmit
Any type error
Starter
Lint
ESLint or npx expo lint, --max-warnings 0 in new projects
Any error, or any warning in new projects
Starter
Circular dependencies
dpdm -T --exit-code circular:1 on the app entry, or madge --circular --extensions ts,tsx src/, or Oxlint import/no-cycle
Any import cycle
Starter
Project health
npx expo-doctor (Expo projects)
Any failed check
Starter
Unit and functional tests
Jest + React Native Testing Library
Any failure
Starter
Render performance
Reassure, comparing the PR against main in the same CI run
A statistically significant slowdown or extra renders beyond the budget
Growing
Bundle size
Production export measured against main (Expo Atlas to inspect)
Growth beyond the budget with no note in the PR
Growing
Device performance
Flashlight on a release Android build, critical journeys
Score drops below the stored baseline
Scale
E2E
Maestro (EAS Workflows job in Expo projects)
Any failed flow
Scale
CI1NEVER introduce an import cycle. The usual cause is a barrel file: inside a feature, import siblings directly, never through the feature’s own index.ts; index.ts is only for other features (S3). Type-only imports (import type) are excluded from the cycle check.
CI2MUST add a Reassure test (.perf-test.tsx) for list rows, heavy screens and anything a PR claims to make faster. Compare against main on the same CI machine, never against numbers from another machine.
CI3MUST keep budgets (bundle size, render time, device score) in the repo’s config. Going over a budget needs a guardrail exception with the reason (D2), never a silently raised budget.
CI4NEVER hide a flaky test with automatic retries. Quarantine it with a linked issue and fix it within the sprint.
Builds and releases
R1MUST build anything for testers or stores in CI (EAS Build / Workflows or the repo’s CI), never on a laptop.
R2MUST ship JavaScript-only changes as over-the-air updates and native changes as new builds: an update can only change the JS layer of the build it targets. Set a runtime version policy; fingerprint is the safer default because it changes whenever native code changes.
R3NEVER push an over-the-air update to all users at once: go through a preview channel, roll out in stages, and keep the previous update ready to roll back.
R4NEVER commit secrets, signing keys or keystores. They live in the CI or EAS secret store.
R5MUST let CI bump version and build numbers, never by hand.
R6NEVER, as an agent, start a production build, publish an update or submit to a store without the human’s explicit approval in that conversation.
Level
CI on every PR
Releases
Starter
Types, lint, circular dependencies, project health, unit and functional tests
Manual store release from a CI build
Growing
+ render performance, bundle size, preview build per PR
+ OTA updates through a preview channel
Scale
+ device performance, Maestro E2E on critical journeys