| name | react-native-testing |
| description | Generates unit, component, and E2E-flow tests for React Native projects, both Expo (managed or bare) and plain React Native CLI, using Jest (jest-expo or the react-native preset) with React Native Testing Library, plus Maestro or Detox for E2E. Use when the user asks to test a React Native screen, component, or hook, mentions Expo, expo-router, jest-expo, React Native Testing Library, Maestro, or Detox, or has a package.json declaring react-native. For a web React app without react-native, use react-testing instead; for Flutter, use flutter-testing. |
| license | MIT |
| compatibility | Requires Node.js and the project's existing package manager. Requires a package.json declaring react-native. |
| metadata | {"platform":"react-native","report-source":"independent research (Expo/expo-router/jest-expo official docs, Maestro and Detox official docs) conducted for this skill, no corresponding section in testing-methodologies-deep-research-report.txt"} |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash |
| paths | ["**/*.tsx","**/*.jsx","app/**","package.json"] |
React Native Testing
Writes unit, component, and E2E-flow tests for React Native projects,
covering Expo (managed and bare) and plain React Native CLI in one skill,
branching on whichever is actually detected. Writing the test files is
the deliverable. Running the suite and verifying it — including the
fault-injection self-check — is a separate, optional step this skill
offers but never runs without being asked. See
Step 6.
Progress checklist
Copy this into your response and check items off as you go:
- [ ] 1. Detect stack (scripts/detect_stack.sh)
- [ ] 2. Audit project structure and existing test conventions
- [ ] 3. Ask the user what to test (layer + scope) — do not assume
- [ ] 4. State the test plan explicitly
- [ ] 5. Generate tests following AAA, boundary-only mocking
- [ ] 6. Report what was written; offer to run + verify — do not run yet
- [ ] 7. Only if asked: run tests, fault-injection self-check, report results
Step 1 — Detect stack
Run scripts/detect_stack.sh from the project root. It confirms this is a
React Native project (the script errors out and points to react-testing
if react-native isn't declared), identifies which of the three workflows
applies — Expo managed, Expo bare, or plain React Native CLI — and reports
the existing test runner preset, React Native Testing Library (RNTL),
state-management library, expo-router presence, E2E tooling, and test file
convention already in use.
The workflow determines the correct Jest preset: jest-expo for both Expo
managed and Expo bare, the plain react-native preset for RN CLI without
Expo. Never mix these up, and never introduce a second, competing test
runner into a project that already picked one.
Step 2 — Audit project structure
Before writing anything:
- Classify the target: a pure function (formatter, selector, hook logic
with no native calls) vs a screen/component that renders and handles
user interaction vs a native-module-touching piece of code (camera,
location, clipboard, notifications). See
reference/component-testing.md and
reference/native-module-mocking.md.
- If
expo-router is present, check whether the target is a route file
under app/. Route-level behavior (navigation, params, deep links)
needs expo-router/testing-library, not a plain component render — see
.
Never place a test file inside itself; expo-router treats every
file there as a route.