frontend-test

Generates Vitest unit tests, React Testing Library component tests, and Playwright E2E tests for React 19 frontends.

Updated Aug 9, 2026
One-click install
npx skills add https://github.com/stbui/trade-crawlee --skill frontend-test-stbui
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: frontend-test
Source: https://github.com/stbui/trade-crawlee/tree/main/.claude/skills/frontend-test
Command: npx skills add https://github.com/stbui/trade-crawlee --skill frontend-test-stbui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend projects often lack consistent automated test coverage, leaving utility functions, hooks, API layers, and components untested against edge cases and regressions. This Skill establishes a complete testing infrastructure and generates runnable, high-quality test suites for React 19 + Ant Design v6 + TypeScript 5 projects. ## Core Features & Use Cases - Test Infrastructure Setup: Configures Vitest with jsdom, @testing-library/react, jest-dom, coverage reporting, and package.json test scripts. - Multi-Layer Test Generation: Writes unit tests for pure functions and API clients, hook tests with renderHook, and component render/interaction tests wrapped in Ant Design ConfigProvider + App context. - Coverage Discipline: Enforces AAA test structure, normal/exception/boundary scenario coverage, and tests/ directory conventions with standardized naming. - Use Case: After fixing a bug in a bond yield calculator, ask the Skill to generate regression tests covering normal inputs, invalid prices, and boundary values, then verify with npx vitest run. ## Quick Start Generate Vitest unit tests and React Testing Library component tests for the files in src/lib/bond and src/views/bond, covering normal, exception, and boundary scenarios.

Frequently Asked Questions about frontend-test

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

FAQPage Schema
How do I write unit tests for React utility functions with Vitest?▼

Use Vitest's describe/it/expect API to test pure functions with normal, exception, and boundary cases. Place tests in a __tests__ directory next to the source file, named calculator.test.ts, and run them with npx vitest run.

How to test React components that use Ant Design v6?▼

Wrap the component in ConfigProvider and App context before rendering with @testing-library/react. Then query elements with screen.getByText or getByRole and simulate interactions using @testing-library/user-event.

What testing libraries work with Vite and React 19?▼

Vitest integrates natively with Vite as the test runner, paired with @testing-library/react for component rendering, @testing-library/jest-dom for DOM assertions, jsdom for the browser environment, and Playwright for E2E tests.

How do I test custom React hooks with renderHook?▼

Use renderHook from @testing-library/react to mount the hook, then wrap state updates in act() and assert on result.current. This avoids calling the hook outside a component, which React forbids.

Should I mock fetch when testing API client code?▼

Yes, mock globalThis.fetch with vi.fn() to simulate resolved JSON responses and rejected network errors. Tests must never make real network requests so they run offline and produce no side effects.

When should I not write frontend unit tests?▼

Skip tests for pure configuration files like vite.config.ts, third-party library internals, and visual styling without screenshot requirements. Backend NestJS code should use a dedicated backend testing approach instead.