MCPInstall

react-native-testing

Master testing - Jest, Testing Library, Detox E2E, and CI/CD integration

Installs
112
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/pluginagentmarketplace/custom-plugin-react-native --skill react-native-testing
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads react-native-testing automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

React Native Testing Skill

Learn comprehensive testing strategies including unit tests, component tests, and E2E tests.

Prerequisites

  • React Native basics
  • Understanding of async/await
  • Familiarity with testing concepts

Learning Objectives

After completing this skill, you will be able to:

  • Configure Jest for React Native
  • Write component tests with Testing Library
  • Mock native modules and APIs
  • Implement E2E tests with Detox/Maestro
  • Set up CI/CD test pipelines

Topics Covered

1. Jest Setup

// jest.config.js
module.exports = {
  preset: 'react-native',
  setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
  transformIgnorePatterns: [
    'node_modules/(?!(react-native|@react-native)/)',
  ],
};

2. Component Testing

import { render, screen, fireEvent } from '@testing-library/react-native';
import { Button } from './Button';

describe('Button', () => {
  it('calls onPress when pressed', () => {
    const onPress = jest.fn();
    render(<Button title="Click" onPress={onPress} />);

    fireEvent.press(screen.getByText('Click'));

    expect(onPress).toHaveBeenCalled();
  });
});

3. Hook Testing

import { renderHook, act } from '@testing-library/react-native';
import { useCounter } from './useCounter';

describe('useCounter', () => {
  it('increments count', () => {
    const { result } = renderHook(() => useCounter());

    act(() => result.current.increment());

    expect(result.current.count).toBe(1);
  });
});

4. Mocking

// Mock native module
jest.mock('@react-native-async-storage/async-storage', () => ({
  setItem: jest.fn(),
  getItem: jest.fn(),
}));

// Mock API
jest.mock('./api', () => ({
  fetchUser: jest.fn().mockResolvedValue({ id: '1', name: 'Test' }),
}));

5. E2E with Detox

describe('Login', () => {
  beforeAll(async () => {
    await device.launchApp();
  });

  it('should login successfully', async () => {
    await element(by.id('email')).typeText('test@example.com');
    await element(by.id('password')).typeText('password');
    await element(by.id('login-btn')).tap();

    await expect(element(by.id('home'))).toBeVisible();
  });
});

Quick Start Example

// ProductCard.test.tsx
import { render, screen, fireEvent } from '@testing-library/react-native';
import { ProductCard } from './ProductCard';

const mockProduct = {
  id: '1',
  title: 'Test Product',
  price: 99.99,
};

describe('ProductCard', () => {
  it('renders product info', () => {
    render(<ProductCard {...mockProduct} onPress={jest.fn()} />);

    expect(screen.getByText('Test Product')).toBeOnTheScreen();
    expect(screen.getByText('$99.99')).toBeOnTheScreen();
  });

  it('handles press', () => {
    const onPress = jest.fn();
    render(<ProductCard {...mockProduct} onPress={onPress} />);

    fireEvent.press(screen.getByRole('button'));

    expect(onPress).toHaveBeenCalledWith('1');
  });
});

Common Errors & Solutions

ErrorCauseSolution
"Cannot find module"Missing mockAdd jest.mock()
Async timeoutMissing awaitUse waitFor()
Element not foundWrong queryCheck testID/role

Validation Checklist

  • Unit tests pass
  • Component tests cover interactions
  • E2E tests complete flows
  • Coverage meets threshold (80%+)

Usage

Skill("react-native-testing")

Bonded Agent: 06-react-native-testing

FAQ

What does the react-native-testing skill do?

Master testing - Jest, Testing Library, Detox E2E, and CI/CD integration

How do I install react-native-testing?

Run npx skills add https://github.com/pluginagentmarketplace/custom-plugin-react-native --skill react-native-testing in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/react-native-testing/ (personal) or .claude/skills/react-native-testing/ (project).

Which AI agents can use react-native-testing?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is react-native-testing safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains react-native-testing?

It is published by pluginagentmarketplace in pluginagentmarketplace/custom-plugin-react-native. It has 112 recorded installs.

More from pluginagentmarketplace/custom-plugin-react-native

View all →

react-native-animations

pluginagentmarketplace/custom-plugin-react-native

Master animations - Reanimated 3, Gesture Handler, layout animations, and performance optimization

Frontend & Design663 installs

react-native-navigation

pluginagentmarketplace/custom-plugin-react-native

Open the skill to read its SKILL.md instructions.

react-native-basics

pluginagentmarketplace/custom-plugin-react-native

Open the skill to read its SKILL.md instructions.

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs