test
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRun tests for the React codebase.
Arguments:
- $ARGUMENTS: Channel, flags, and test pattern
Usage Examples:
- - Run with source channel (default)
/test ReactFiberHooks - - Run with experimental channel
/test experimental ReactFiberHooks - - Run with www-modern channel
/test www ReactFiberHooks - - Test VARIANT=false
/test www variant false ReactFiberHooks - - Run with stable channel
/test stable ReactFiberHooks - - Run with www-classic channel
/test classic ReactFiberHooks - - Run in watch mode (TDD)
/test watch ReactFiberHooks
Release Channels:
- - Source/canary channel, uses ReactFeatureFlags.js defaults
(default) - - Source/experimental channel with EXPERIMENTAL flags = true
experimental - - www-modern channel with VARIANT flags = true
www - - www channel with VARIANT flags = false
www variant false - - What ships to npm
stable - - Legacy www-classic (rarely needed)
classic
Instructions:
- Parse channel from arguments (default: source)
- 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>
- (default) →
- Report test results and any failures
Hard Rules:
- Use --silent to see failures - This limits the test output to only failures.
- 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 AND
wwwforwww variant falseflags.__VARIANT__ - Test skipped unexpectedly - Check for pragma; see
@gateskill.feature-flags
为React代码库运行测试。
参数:
- $ARGUMENTS:渠道、标志和测试模式
使用示例:
- - 使用source渠道运行(默认)
/test ReactFiberHooks - - 使用experimental渠道运行
/test experimental ReactFiberHooks - - 使用www-modern渠道运行
/test www ReactFiberHooks - - 测试__VARIANT__=false
/test www variant false ReactFiberHooks - - 使用stable渠道运行
/test stable ReactFiberHooks - - 使用www-classic渠道运行
/test classic ReactFiberHooks - - 以监听模式运行(TDD)
/test watch ReactFiberHooks
发布渠道:
- - Source/canary渠道,使用ReactFeatureFlags.js的默认设置
(default) - - Source/experimental渠道,__EXPERIMENTAL__标志设为true
experimental - - www-modern渠道,__VARIANT__标志设为true
www - - www渠道,__VARIANT__标志设为false
www variant false - - 发布至npm的版本
stable - - 遗留的www-classic(很少需要)
classic
操作步骤:
- 从参数中解析渠道(默认:source)
- 映射为yarn命令:
- (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>
- (default) →
- 报告测试结果及任何失败情况
硬性规则:
- 使用--silent查看失败情况 - 这会将测试输出限制为仅显示失败内容。
- 使用--no-watchman - 这是沙箱环境中常见的失败点。
常见错误:
- 未指定测试模式 - 会运行所有测试,速度极慢。请始终指定测试模式。
- 遗漏两种www变体 - 针对__VARIANT__标志,需同时测试和
www。www variant false - 测试意外跳过 - 检查编译指令;请查看
@gate技能。feature-flags