·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