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