react-testing

Automate React component, hook, and network interaction testing with Vitest or Jest.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing React SPAs with RTL-based component testing, hook testing, and end-to-end coverage can be complex to set up and maintain. This skill provides a structured approach to select appropriate testing tools (Vitest or Jest), write accessible component tests, and integrate network mocking and E2E tooling to ensure robust test suites.

Core Features & Use Cases

  • Support for selecting Vitest or Jest as the test runner depending on project needs.
  • Component and hook testing using React Testing Library with accessible queries.
  • Network mocking via msw to simulate real-world API interactions at the boundary.
  • End-to-end testing setup with Playwright or Cypress to cover flows beyond unit tests.
  • Practical guidance for test organization, maintenance, and integrating tests into CI.

Quick Start

Install the required dev dependencies and write your first RTL-based test for a component using Vitest.

Frequently Asked Questions about react-testing

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

FAQPage Schema
How do I set up React component testing with Vitest and React Testing Library?

React component testing with Vitest and RTL requires installing dev dependencies and writing accessible queries to render and assert component behavior. This workflow provides a structured setup to initialize the runner and write your first component tests.

What is the best way to mock API calls in React tests using msw?

Mocking API calls in React tests using msw involves intercepting network requests at the boundary to simulate real-world interactions. This approach provides structured network mocking guidance to ensure components handle various API responses correctly without hitting real endpoints.

Can I test custom React hooks with renderHook and React Testing Library?

You can test custom React hooks using the renderHook method provided by React Testing Library. This skill supports hook testing workflows by applying renderHook to verify hook state logic and side effects in isolation from component rendering layers.

Does this React testing workflow support both Vitest and Jest as test runners?

This React testing workflow supports selecting either Vitest or Jest as the test runner depending on your project needs. It provides practical guidance to configure the chosen runner for RTL-based component tests and hook testing within React SPAs.

How do I integrate Playwright or Cypress for end-to-end testing in a React SPA?

Integrating Playwright or Cypress for end-to-end testing in a React SPA extends coverage beyond unit tests to full user flows. This skill provides setup guidance to configure E2E tooling alongside RTL component tests and msw mocks.

Why use accessible queries in React Testing Library instead of querying by test ID?

Using accessible queries in React Testing Library ensures tests interact with components as users do, improving maintainability. This skill applies accessible queries to verify component behavior, leading to robust test suites that reflect real user accessibility patterns.