sync-testing-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Scan package tests, update @.claude/skills/testing/testing.mdc with new patterns. Follow writing-skills: DRY, ultra-concise, token-efficient.
Process:
  1. Glob
    packages/[PACKAGE]/**/*.spec.{ts,tsx}
  2. Read 6-8 diverse tests: plugins, transforms, components, hooks, utils
  3. Identify patterns NOT in testing.mdc:
    • Imports (ONLY
      mock
      /
      spyOn
      from bun:test - describe/it/expect are global)
    • Test organization, mocking, assertions, RTL, edge cases
  4. Update testing.mdc: Add to existing sections (DRY), one example per pattern, Quick Reference if frequent
  5. Report:
    Found X patterns → Updated Y sections
Critical:
  • Only actual codebase patterns. No theoretical examples. No duplication.
  • Test globals (
    describe
    ,
    it
    ,
    expect
    , etc.) are global via
    tooling/config/global.d.ts
    - NO imports needed
  • ONLY import
    mock
    and
    spyOn
    when used
Package: Specify path (e.g.,
packages/media
)
扫描包内测试用例,使用新的模式更新@.claude/skills/testing/testing.mdc。遵循写作准则:DRY(不重复造轮子)、极度简洁、高效使用Token。
流程:
  1. 匹配路径
    packages/[PACKAGE]/**/*.spec.{ts,tsx}
  2. 读取6-8个不同类型的测试用例:插件、转换器、组件、钩子、工具函数
  3. 识别testing.mdc中未包含的模式:
    • 导入规则(仅从bun:test导入
      mock
      /
      spyOn
      —— describe/it/expect为全局变量)
    • 测试组织方式、模拟、断言、RTL、边界情况
  4. 更新testing.mdc:添加至现有章节(遵循DRY原则),每个模式配一个示例,若为高频模式则加入快速参考
  5. 报告:
    发现X种模式 → 更新Y个章节
注意事项:
  • 仅使用代码库中的实际模式。不加入理论示例。禁止重复内容。
  • 测试全局变量(
    describe
    it
    expect
    等)通过
    tooling/config/global.d.ts
    全局引入——无需导入
  • 仅在使用时导入
    mock
    spyOn
包路径: 指定路径(例如:
packages/media