·react-testing-patterns
</>

react-testing-patterns

hieutrtr/ai1-skills

使用测试库和 Vitest 反应组件和挂钩测试模式。在为 React 组件、自定义挂钩或数据获取逻辑编写测试时使用。涵盖组件渲染测试、用户交互模拟、异步状态测试、用于 API 模拟的 MSW、使用 renderHook 进行钩子测试、可访问性断言和快照测试指南。不涵盖 E2E 测试(使用 e2e-testing)或 TDD 工作流实施(使用 tdd-workflow)。

20安装·0热度·@hieutrtr

安装

$npx skills add https://github.com/hieutrtr/ai1-skills --skill react-testing-patterns

SKILL.md

Prefer findBy over waitFor + getBy for elements that appear asynchronously.

Create a custom render that wraps components with required providers:

See references/component-test-template.tsx for an annotated test file template. See references/msw-handler-examples.ts for MSW handler patterns. See references/hook-test-template.tsx for hook testing patterns.

使用测试库和 Vitest 反应组件和挂钩测试模式。在为 React 组件、自定义挂钩或数据获取逻辑编写测试时使用。涵盖组件渲染测试、用户交互模拟、异步状态测试、用于 API 模拟的 MSW、使用 renderHook 进行钩子测试、可访问性断言和快照测试指南。不涵盖 E2E 测试(使用 e2e-testing)或 TDD 工作流实施(使用 tdd-workflow)。 来源:hieutrtr/ai1-skills。

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/hieutrtr/ai1-skills --skill react-testing-patterns
分类
</>开发工具
认证
收录时间
2026-02-06
更新时间
2026-02-18

快速解答

什么是 react-testing-patterns?

使用测试库和 Vitest 反应组件和挂钩测试模式。在为 React 组件、自定义挂钩或数据获取逻辑编写测试时使用。涵盖组件渲染测试、用户交互模拟、异步状态测试、用于 API 模拟的 MSW、使用 renderHook 进行钩子测试、可访问性断言和快照测试指南。不涵盖 E2E 测试(使用 e2e-testing)或 TDD 工作流实施(使用 tdd-workflow)。 来源:hieutrtr/ai1-skills。

如何安装 react-testing-patterns?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/hieutrtr/ai1-skills --skill react-testing-patterns 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/hieutrtr/ai1-skills