rn-testing

Configure Jest presets and mocks for React Native component and hook tests.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill rn-testing-aratkruglik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rn-testing
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/react-native-plugin/skills/rn-testing
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill rn-testing-aratkruglik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing React Native apps often suffers from flaky tests, incomplete mocks, and fragmented patterns. This skill provides a cohesive setup for Jest (Expo-managed or bare RN), comprehensive mocks for native modules (react-native-reanimated, expo-secure-store, react-native-mmkv, etc.), and ready-to-run patterns for component tests, hook tests, and optional end-to-end testing.

Core Features & Use Cases

  • Configure Jest presets for Expo managed or bare RN projects.
  • Provide mocks for common native modules (reanimated, expo-secure-store, react-native-mmkv, etc.).
  • Support component tests with @testing-library/react-native and hook tests via renderHook.
  • Offer guidance for Detox or Maestro (optional) end-to-end testing.
  • Include network mocking guidance with msw in tests.

Quick Start

Install and run the standard RN test setup to execute component and hook tests with Jest in your project.

Frequently Asked Questions about rn-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Jest for React Native component testing in an Expo managed project?

To configure Jest for React Native testing, you need to set up specific presets for Expo managed or bare projects alongside safe mocks for native modules. This ensures reliable component tests using @testing-library/react-native and repeatable hook tests via renderHook.

Why does my React Native Jest test fail due to missing native module mocks?

React Native Jest tests fail without native module mocks because libraries like react-native-reanimated or react-native-mmkv rely on native code. Providing comprehensive mocks for these modules prevents flaky tests and ensures reliable component and hook testing execution.

What's the best way to test React Native hooks with Jest?

The best way to test React Native hooks is using the renderHook method provided by @testing-library/react-native within a Jest setup. This approach allows you to execute hook tests safely while maintaining consistent native module mocks across your testing environment.

Can I use Detox or Maestro for end-to-end testing in a bare React Native workflow?

Yes, you can integrate Detox or Maestro for end-to-end testing strategies in both bare and Expo managed React Native projects. They provide guidance for configuring E2E flows alongside your Jest component and hook tests to ensure comprehensive application coverage.

Does this React Native testing setup support network mocking with msw?

Yes, this React Native testing setup includes network mocking guidance with msw to intercept API calls during Jest execution. This ensures your component and hook tests run reliably without depending on actual external network responses.

How do I organize test files and conventions for a React Native app?

Organizing React Native testing requires clear file conventions and setup steps prescribed for your Jest environment to ensure repeatable results. It enforces standardized patterns for component and hook tests, preventing fragmented testing logic across your project.