w-unit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
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.
使用单元测试覆盖所要求的行为。遵循
vitest-v5
(或该技术栈的测试 skill)以及现有文件约定。不要追求覆盖率百分比。
  1. 阅读相邻测试和测试 skill。将
    *.test.ts
    与实现文件放在同一目录。
  2. 测试可能失败的行为:公共 API、错误路径,以及本次变更需要防范的回归。
  3. 仅在有文档说明的边界处使用
    mock
    。优先使用真实类型以及仓库已有的 factories。
  4. 先运行聚焦的测试文件,然后运行 package 测试脚本。
  5. 文档:如果行为或命令发生变化,更新
    /w-docs
    。