main
md 46 lines 2.04 KB
Rendered Raw
1 ---
2 name: test
3 description: Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.
4 ---
5
6 Run tests for the React codebase.
7
8 Arguments:
9 - $ARGUMENTS: Channel, flags, and test pattern
10
11 Usage Examples:
12 - `/test ReactFiberHooks` - Run with source channel (default)
13 - `/test experimental ReactFiberHooks` - Run with experimental channel
14 - `/test www ReactFiberHooks` - Run with www-modern channel
15 - `/test www variant false ReactFiberHooks` - Test __VARIANT__=false
16 - `/test stable ReactFiberHooks` - Run with stable channel
17 - `/test classic ReactFiberHooks` - Run with www-classic channel
18 - `/test watch ReactFiberHooks` - Run in watch mode (TDD)
19
20 Release Channels:
21 - `(default)` - Source/canary channel, uses ReactFeatureFlags.js defaults
22 - `experimental` - Source/experimental channel with __EXPERIMENTAL__ flags = true
23 - `www` - www-modern channel with __VARIANT__ flags = true
24 - `www variant false` - www channel with __VARIANT__ flags = false
25 - `stable` - What ships to npm
26 - `classic` - Legacy www-classic (rarely needed)
27
28 Instructions:
29 1. Parse channel from arguments (default: source)
30 2. Map to yarn command:
31 - (default) → `yarn test --silent --no-watchman <pattern>`
32 - experimental → `yarn test -r=experimental --silent --no-watchman <pattern>`
33 - stable → `yarn test-stable --silent --no-watchman <pattern>`
34 - classic → `yarn test-classic --silent --no-watchman <pattern>`
35 - www → `yarn test-www --silent --no-watchman <pattern>`
36 - www variant false → `yarn test-www --variant=false --silent --no-watchman <pattern>`
37 3. Report test results and any failures
38
39 Hard Rules:
40 1. **Use --silent to see failures** - This limits the test output to only failures.
41 2. **Use --no-watchman** - This is a common failure in sandboxing.
42
43 Common Mistakes:
44 - **Running without a pattern** - Runs ALL tests, very slow. Always specify a pattern.
45 - **Forgetting both www variants** - Test `www` AND `www variant false` for `__VARIANT__` flags.
46 - **Test skipped unexpectedly** - Check for `@gate` pragma; see `feature-flags` skill.