test

作者: facebook

在React程式碼庫中跨多個發行通道與配置執行測試。支援六個發行通道:source(預設)、experimental、www、www with variant false、stable 與 classic,各自具有不同的功能旗標配置。接受測試模式、TDD 的監控模式,以及用於測試不同程式碼路徑的變體旗標。需要明確的測試模式參數以避免執行整個測試套件;使用 --silent 旗標來顯示失敗資訊,並使用 --no-watchman 進行沙箱隔離...

npx skills add https://github.com/facebook/react --skill test

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.

來自 facebook 的更多技能

gc-safe-coding
facebook
完整解釋與理由請參閱 doc/GCSafeCoding.md。
app-review-prep
facebook
準備將 Meta 應用程式提交至 App Review——檢查目前狀態、未完成的要求、已授予的權限及提交紀錄。請在提交應用程式前使用……
api-health
facebook
監控 Meta 應用程式的 API 健康狀態 — 檢查速率限制、呼叫量與 API 棄用情況。用於診斷節流問題、規劃容量,或為 API 版本…做好準備。
debug-webhooks
facebook
排解 Meta 應用程式的 webhook 問題——檢查作用中的訂閱、找出設定錯誤,並傳送測試負載以驗證傳遞。當……時使用。
api-integration
facebook
引導開發者從零開始設定 Meta API 整合 — 找出正確的 API、取得設定指南、驗證需求、…
webhook-setup
facebook
端到端設定 Meta 應用程式的 Webhook — 探索可用主題、訂閱欄位,並透過測試負載驗證。在為… 設定 Webhook 時使用。
test-ui
facebook
使用 iwsdk CLI 針對 poke 範例測試 UI 系統(PanelUI、ScreenSpace)。
flags
facebook
檢查並比較 React 發佈通道中的功能旗標狀態。檢視所有通道(www、www-modern、canary、next、experimental、rn 變體)的旗標,或使用 --diff 比較特定通道。輸出格式包括預設表格檢視、CSV 匯出及清理狀態分組。旗標狀態以符號表示:啟用(✅)、停用(❌)、變體測試(🧪)、僅分析(📊)。常見陷阱:__VARIANT__ 旗標在 www 上會以兩種狀態進行測試;使用 --diff 可找出有意義的差異。