‹ 首页

test-discipline

@fritzandfriends · 收录于 昨天 · 上游提交 1 个月前

Update tests when changing APIs — no exceptions

适合你,如果每次改接口都要手动修测试

/ 通过 npx 安装 校验哈希
npx oh-my-skill add fritzandfriends/blazorwebformscomponents/test-discipline
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- fritzandfriends/blazorwebformscomponents/test-discipline
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify fritzandfriends/blazorwebformscomponents/test-discipline
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
449GitHub stars
~392上下文体积 · 单文件
索引托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 3154758
Context

When APIs or public interfaces change, tests must be updated in the same commit. When test assertions reference file counts or expected arrays, they must be kept in sync with disk reality. Stale tests block CI for other contributors.

Patterns
  • API changes → test updates (same commit): If you change a function signature, public interface, or exported API, update the corresponding tests before committing
  • Test assertions → disk reality: When test files contain expected counts (e.g., EXPECTED_FEATURES, EXPECTED_SCENARIOS), they must match the actual files on disk
  • Add files → update assertions: When adding docs pages, features, or any counted resource, update the test assertion array in the same commit
  • CI failures → check assertions first: Before debugging complex failures, verify test assertion arrays match filesystem state
Examples

Correct:

  • Changed auth API signature → updated auth.test.ts in same commit
  • Added distributed-mesh.md to features/ → added 'distributed-mesh' to EXPECTED_FEATURES array
  • Deleted two scenario files → removed entries from EXPECTED_SCENARIOS

Incorrect:

  • Changed spawn parameters → committed without updating casting.test.ts (CI breaks for next person)
  • Added built-in-roles.md → left EXPECTED_FEATURES at old count (PR blocked)
  • Test says "expected 7 files" but disk has 25 (assertion staleness)
Anti-Patterns
  • Committing API changes without test updates ("I'll fix tests later")
  • Treating test assertion arrays as static (they evolve with content)
  • Assuming CI passing means coverage is correct (stale assertions can pass while being wrong)
  • Leaving gaps for other agents to discover
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。