testing-test-writing
使用Vitest进行单元测试和Playwright进行端到端测试,为核心用户流程和关键功能编写战略性、以行为为重点的测试。在编写测试文件、测试工具或为关键路径实现测试覆盖率时使用此技能。在处理Vitest测试文件(.test.ts, .spec.ts)、Playwright E2E测试套件、测试设置和配置文件(vitest.config.ts, test-setup.ts)、外部依赖的模拟实现、测试工具函数或测试助手、使用React Testing Library的组件测试文件、API路由测试文件或Content Collections和数据获取逻辑的集成测试时。
📖 中文导读:使用Vitest进行单元测试和Playwright进行端到端测试,为核心用户流程和关键功能编写战略性、以行为为重点的测试。在编写测试文件、测试工具或为关键路径实现测试覆盖率时使用此技能。在处理Vitest测试文件(.test.ts, .spec.ts)、Playwright E2E测试套件、测试设置和配置文件(vitest.config.ts, test-setup.ts)、外部依赖的模拟实现、测试工具函数或测试助手、使用React Testing Library的组件测试文件、API路由测试文件或Content Collections和数据获取逻辑的集成测试时。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Testing Test Writing description: Write strategic, behavior-focused tests for core user flows and critical functionality using Vitest for unit tests and Playwright for end-to-end testing. Use this skill when writing test files, testing utilities, or implementing test coverage for critical paths. When working on Vitest test files (.test.ts, .spec.ts), Playwright E2E test suites, test setup and configuration files (vitest.config.ts, test-setup.ts), mock implementations for external dependencies, testing utility functions or test helpers, component test files using React Testing Library, API route test files, or integration tests for Content Collections and data fetching logic.
Testing Test Writing
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle testing test writing.
When to use this skill
- When writing Vitest unit tests for utilities, components, or business logic
- When creating Playwright E2E tests for critical user workflows
- When testing API routes and server-side logic
- When implementing mocks for external dependencies (APIs, databases, file systems)
- When testing Content Collection queries and data transformations
- When writing integration tests for data fetching logic
- When setting up test configurations (vitest.config.ts, test-setup.ts)
- When using React Testing Library for component testing
- When focusing tests on behavior rather than implementation details
- When writing clear, descriptive test names that explain expected outcomes
- When prioritizing tests for core user flows over edge cases during development
Instructions
For details, refer to the information provided in this file: testing test writing