W Unit

blockmatic/basilic-skills/skills/workflow/w-unit

作者 blockmatic7e05e2abd052dc6b526e8a28e36d102d42bfd635无许可证1 个星标收录于 2026年10月9日更新于 2026年10月9日仓库6天前更新

Add unit tests for the current change using the repo test skill and colocated files.

AI 生成的概览

指导为当前改动添加单元测试,测试文件与实现放在一起,并遵循仓库测试约定。

功能
该技能提供一套简短流程,为指定行为编写单元测试。它要求先阅读相邻测试和仓库的测试技能,将测试文件与实现放在同一目录,测试公开 API、错误路径以及本次改动涉及的回归,只在有文档说明的边界处进行 mock,先运行聚焦的测试文件再运行包的测试脚本。它还提示在行为或命令变化时更新文档。
适用场景
当代码改动需要单元测试覆盖,且仓库已有既定的测试技能和文件约定时使用。适合为新行为、错误路径或特定回归补充测试。
运行要求
不附带脚本,仅为说明性指令。需要仓库中已有测试技能(例如 vitest-v5)以及包的测试脚本。

Cover the requested behavior with unit tests. Follow vitest-v5 (or the stack's test skill) and existing file conventions. Do not chase coverage percentage.

  1. Read neighboring tests and the test skill. Colocate *.test.ts beside the implementation.
  2. Test the behavior that can fail: public API, error paths, and the regression this change needs.
  3. Mock only at documented boundaries. Prefer real types and factories the repo already uses.
  4. Run the focused file, then the package test script.
  5. Docs: /w-docs if behavior or commands changed.

来源与署名

来源:blockmatic/basilic-skills位于skills/workflow/w-unit提交7e05e2a

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架