frontend/typescript-testing

Enforce frontend TypeScript testing rules for React components with Vitest, RTL, and MSW.

225|24|Updated Jul 27, 2025
One-click install
npx skills add https://github.com/shinpr/ai-coding-project-boilerplate --skill frontend-typescript-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend/typescript-testing
Source: https://github.com/shinpr/ai-coding-project-boilerplate/tree/main/.claude/skills-ja/frontend/typescript-testing
Command: npx skills add https://github.com/shinpr/ai-coding-project-boilerplate --skill frontend-typescript-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates manual frontend testing by automating React component tests with Vitest, React Testing Library, and MSW for comprehensive coverage.

Core Features & Use Cases

  • Component Testing: Verify user-observable behavior of React components.
  • API Mocking: Use Mock Service Worker for realistic API testing scenarios.

Quick Start

Write tests for a Button component to ensure it calls onClick when clicked.

Core Features & Use Cases

  • Co-location Principle: Keep tests alongside components for better maintainability.

Quick Start

Test the UserProfile component to verify it loads and displays user data correctly with proper loading states and error handling.

Quick Start

Use this Skill to test any React component with user-centric queries and behavior verification.

Frequently Asked Questions about frontend/typescript-testing

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

FAQPage Schema
How do I test React components with user-centric queries?

React Testing Library lets you test components by querying the DOM as users would interact with it. This Skill applies RTL to verify observable behavior, ensuring tests focus on functionality rather than implementation details, with MSW handling realistic API scenarios.

What's the minimum test coverage I should target for React components?

This Skill enforces 60% unit coverage baseline with component-level targets: Atoms 70%, Molecules 65%, Organisms 60%, Custom Hooks 65%, and Utils 70%. Coverage ensures critical paths are tested across your component hierarchy.

How do I mock APIs reliably in frontend tests?

Mock Service Worker provides type-safe API mocking for Vitest and React Testing Library tests. MSW intercepts requests at the network level, enabling realistic testing scenarios without hitting real endpoints while maintaining explicit mock control.

Should I keep tests in the same folder as my components?

Co-locating tests alongside components improves maintainability and discoverability. This Skill follows the co-location principle, making it clear which tests verify which components and reducing navigation overhead during development.

Can I use Vitest with React Testing Library for component testing?

Yes. This Skill uses Vitest as the test runner paired with React Testing Library for user-centric assertions. Together they provide fast unit and integration testing across component types with ADR-0002-compliant coverage targets.

What does reproducible frontend testing mean?

Reproducible tests run consistently regardless of execution order or environment. This Skill enforces explicit mocking, isolation, and deterministic assertions to ensure tests pass reliably across local, CI/CD, and team environments.