Test

react/react/.claude/skills/test

作者 reactb618bbb44226无许可证250K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库昨天更新

Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.

AI 生成的概览

通过将渠道与测试模式映射到对应的 yarn test 命令来运行 React 核心测试。

功能
解析渠道参数(default、experimental、www、www variant false、stable、classic)以及测试模式,映射到相应的 yarn test 命令,并以 --silent 和 --no-watchman 运行。随后报告测试结果和失败项。还会提示常见问题,例如未指定模式或遗漏两个 www 变体。
适用场景
适用于需要运行 React 代码库测试的场景,尤其是在选择特定发布渠道或测试 VARIANT 标志时。也适用于 watch 模式的 TDD 运行,或测试意外被跳过、需要检查 @gate 编译指示时。
运行要求
需要已检出的 React 代码库,并可使用 yarn 及其测试脚本(test、test-stable、test-classic、test-www);该技能不附带任何脚本。

Run tests for the React codebase.

Arguments:

  • $ARGUMENTS: Channel, flags, and test pattern

Usage Examples:

  • /test ReactFiberHooks - Run with source channel (default)
  • /test experimental ReactFiberHooks - Run with experimental channel
  • /test www ReactFiberHooks - Run with www-modern channel
  • /test www variant false ReactFiberHooks - Test VARIANT=false
  • /test stable ReactFiberHooks - Run with stable channel
  • /test classic ReactFiberHooks - Run with www-classic channel
  • /test watch ReactFiberHooks - Run in watch mode (TDD)

Release Channels:

  • (default) - Source/canary channel, uses ReactFeatureFlags.js defaults
  • experimental - Source/experimental channel with EXPERIMENTAL flags = true
  • www - www-modern channel with VARIANT flags = true
  • www variant false - www channel with VARIANT flags = false
  • stable - What ships to npm
  • classic - Legacy www-classic (rarely needed)

Instructions:

  1. Parse channel from arguments (default: source)
  2. Map to yarn command:
    • (default) → yarn test --silent --no-watchman <pattern>
    • experimental → yarn test -r=experimental --silent --no-watchman <pattern>
    • stable → yarn test-stable --silent --no-watchman <pattern>
    • classic → yarn test-classic --silent --no-watchman <pattern>
    • www → yarn test-www --silent --no-watchman <pattern>
    • www variant false → yarn test-www --variant=false --silent --no-watchman <pattern>
  3. Report test results and any failures

Hard Rules:

  1. Use --silent to see failures - This limits the test output to only failures.
  2. Use --no-watchman - This is a common failure in sandboxing.

Common Mistakes:

  • Running without a pattern - Runs ALL tests, very slow. Always specify a pattern.
  • Forgetting both www variants - Test www AND www variant false for __VARIANT__ flags.
  • Test skipped unexpectedly - Check for @gate pragma; see feature-flags skill.

来源与署名

来源:react/react位于.claude/skills/test提交b618bbb

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架