AgentSkillsCN

frontend-testing

适用于使用 Vitest 和 React Testing Library 编写或优化前端测试时,采用可靠的测试模式,并结合覆盖率检查,确保测试的全面性和有效性。

SKILL.md
--- frontmatter
name: frontend-testing
description: Use when writing or improving frontend tests with Vitest and React Testing Library using reliable patterns and coverage checks.

Frontend Testing Skill

This Skill provides a framework for generating Vitest and React Testing Library tests for modern frontend applications.

Quick start

Follow the incremental workflow: Utilities/Hooks -> Simple Components -> Complex Components -> Integration Tests.

Critical Workflow

  1. Incremental Approach: Do not generate all tests at once. Follow "Write -> Run -> Fix -> Next".
  2. Integration First: Prefer testing real components over deep mocking.
  3. AAA Pattern: Arrange, Act, Assert.

Reference Guides

See the following for detailed strategies:

Success Criteria

  • 100% function/statement coverage for the target file.
  • 95% branch/line coverage.

  • All tests pass in the terminal.