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 從公開儲存庫中收錄這些內容。

檢舉或申請下架