mcpField
R
react-native-testing

react-native-testing

github.com/maikotrindadeTesting & quality1351 installsUpdated 2d ago
Repository

About react-native-testing

A reference skill for unit and component testing with React Native Testing Library and Jest. It emphasizes choosing guidance for the installed library version and distinguishes these tests from Maestro end-to-end flows.

Key features

  1. 01References for React Native Testing Library v13 and v14
  2. 02Version selection based on package.json
  3. 03Guidance on queries and interaction APIs
  4. 04Async testing and accessibility recommendations
  5. 05Coverage of common testing anti-patterns

Use cases

  1. 01Selecting APIs for an installed library version
  2. 02Writing React Native component tests with Jest
  3. 03Avoiding common query and async-testing mistakes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/maikotrindade/awesome-react-native-skills --skill react-native-testing

After installing, type/react-native-testingin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
best-practices-anti-patterns.md
core-patterns.md
reference-v13-api.md
reference-v14-api.md

Details

From the project README

React Native Testing Library

Deep API reference for @testing-library/react-native v13 and v14.

Scope: unit + component tests with Jest + RNTL. For end-to-end UI flows on real devices/simulators, use Maestro — declarative YAML flows, no code, runs against the built app. RNTL and Maestro are complementary, not alternatives.

IMPORTANT: API signatures, sync/async behavior, and available functions differ between v13 and v14. Always check the project's package.json and load the matching version reference rather than relying on memorized patterns.

Version Detection

Check @testing-library/react-native in package.json:

Core References

TopicDescriptionReference
Core patternsQuery priority, render/screen, userEvent vs fireEvent, waitFor, 11 core rulescore-patterns
v13 API (React 18)Sync render, full method tables, fireEvent sync, React 19 compat shimsreference-v13-api
v14 API (React 19)Async render, await-based APIs, removed APIs, v13→v14 migration codemodsreference-v14-api
Anti-patternsWrong queries, waitFor misuse, unnecessary act, destructuring, missing awaitbest-practices-anti-patterns

Key Recommendations

  • Always use screen for queries — never destructure from render()
  • getByRole first with { name: '...' } option (most accessibility-aware)
  • findBy* for async elements — not waitFor + getBy*
  • userEvent over fireEvent — more realistic interaction simulation
  • queryBy* only for non-existence assertions (.not.toBeOnTheScreen())
  • v14: always await every API (including render, fireEvent, act)

Comments

Markdown supported