Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计未展示

react-testingReact 测试

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

751

周安装

31

GitHub Stars

公开资料未说明

下载量

246
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:react-testing(React 测试)
来源仓库:https://github.com/mintuz/claude-plugins
仓库路径:skills/react-testing
安装命令:
npx skills add mintuz/claude-plugins --skill "react-testing"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add mintuz/claude-plugins --skill "react-testing"

简介

用于辅助 React 组件的测试用例编写和执行。

  • 适合生成单元测试、快照测试和交互模拟脚本。
  • 通过 GitHub 安装,需配合 Jest、React Testing Library 等框架。
  • 测试代码应覆盖主要用户路径和边界条件。react-testing 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 运行测试前确保 mock 数据和异步操作正确处理。

SKILL.md

name
react-testing
description
WHEN testing React components/hooks/context with React Testing Library; NOT e2e; covers renderHook, providers, forms, and anti-patterns.

React Testing Library

This skill focuses on React-specific testing patterns. For general DOM testing patterns (queries, userEvent, async, accessibility), load the frontend-testing skill. For TDD workflow, load the tdd skill.

Core Principles

React components are functions - Test them like functions: inputs (props) → output (rendered DOM).

Test behavior, not implementation:

  • ✅ Test what users see and do
  • ✅ Test through public APIs (props, rendered output)
  • ❌ Don't test component state
  • ❌ Don't test component methods
  • ❌ Don't use shallow rendering

Modern RTL handles cleanup automatically:

  • No manual act() for render, userEvent, or async queries
  • No manual cleanup() - it's automatic
  • Use factory functions instead of beforeEach

Quick Reference

TopicGuide
Testing components, props, and conditional renderingcomponents.md
Testing custom hooks with renderHookhooks.md
Testing context providers and consumerscontext.md
Testing form inputs, submissions, and validationforms.md
Common React testing mistakes to avoidanti-patterns.md
Loading states, error boundaries, portals, Suspenseadvanced.md

When to Use Each Guide

Components

Use components.md when you need:

  • Basic component testing patterns
  • Testing how props affect rendered output
  • Testing conditional rendering
  • Examples of correct vs incorrect component tests

Hooks

Use hooks.md when you need:

  • Testing custom hooks with renderHook
  • Using result.current, act(), and rerender()
  • Testing hooks with props

Context

Use context.md when you need:

  • Using the wrapper option with providers
  • Setting up multiple providers
  • Creating custom render functions for context
  • Testing components that consume context

Forms

Use forms.md when you need:

  • Testing controlled inputs
  • Testing form submissions
  • Testing form validation
  • User interaction patterns with forms

Anti-Patterns

Use anti-patterns.md when you need:

  • When to avoid manual act() wrapping
  • Why manual cleanup() is unnecessary
  • Avoiding beforeEach render patterns
  • Why to avoid testing component internals
  • Why shallow rendering is problematic

Advanced

Use advanced.md when you need:

  • Testing loading states
  • Testing error boundaries
  • Testing portals
  • Testing React Suspense

Summary Checklist

React-specific checks:

  • [ ] Using render() from @testing-library/react (not enzyme's shallow/mount)
  • [ ] Using renderHook() for custom hooks
  • [ ] Using wrapper option for context providers
  • [ ] No manual act() calls (RTL handles it)
  • [ ] No manual cleanup() calls (automatic)
  • [ ] Testing component output, not internal state
  • [ ] Using factory functions, not beforeEach render
  • [ ] Following TDD workflow (see tdd skill)
  • [ ] Using general DOM testing patterns (see frontend-testing skill)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.15%
按下载量换算74

Gemini CLI

21.85%
按下载量换算54

Antigravity

17.34%
按下载量换算43

windsurf

12.06%
按下载量换算30

Codex

7.92%
按下载量换算19

trae

2.87%
按下载量换算7

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills