Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs frontend tests using the repo's configured React, browser, and API-mocking tools such as RTL, MSW, Vitest, and Playwright.
65% 87%+22 ptsof test cases passed
Passed 20 of 23 test cases with the skill, and 15 of 23 without it.
This test ran on v11. v18 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
在选择框架或命令之前,先检查 package.json、锁文件、测试配置以及现有测试的 import。仅在依赖/配置确实存在时才应用 Vitest、React Testing Library、MSW 或 Playwright 的规则。若仓库配置了不同的等效工具,则使用该工具。若无法确定可运行的测试工具,应报告已检查的路径以及缺失的框架或命令,而不是凭空指定。
| 测试类型 | 参考 | 使用场景 |
|---|---|---|
| 单元测试 / 集成测试 | 本文档 | 使用 RTL + Vitest + MSW 实现 React 组件测试 |
| E2E | references/e2e.md | 使用 Playwright 实现浏览器级 E2E 测试 |
import { describe, it, expect, beforeEach, vi } from 'vitest'import { render, screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'vi.mock()对于跨功能复用的共享组件、自定义 hook 和工具函数,应覆盖其公开分支、错误状态和边界契约,因为它们的回归影响范围更大。当行为依赖于多个已渲染单元时,通过集成测试/E2E 测试来验证页面级组合。
单元测试(React Testing Library)
集成测试(React Testing Library + MSW)
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.