npx skills add https://github.com/pproenca/dot-skills --skill vitestVitest 测试框架的全面性能优化与最佳实践指南。包含 8 大类共 44 条规则,按影响程度排序,以指导测试编写、重构和代码审查。
在以下情况下参考本指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 异步模式 | 关键 | async- |
| 2 | 测试设置与隔离 | 关键 | setup- |
| 3 | 模拟模式 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
mock-| 4 | 性能 | 高 | perf- |
| 5 | 快照测试 | 中 | snap- |
| 6 | 环境 | 中 | env- |
| 7 | 断言 | 低-中 | assert- |
| 8 | 测试组织 | 低 | org- |
async-await-assertions - 等待异步断言以防止误报async-return-promises - 从测试函数返回 Promiseasync-fake-timers - 对时间相关代码使用假定时器async-waitfor-polling - 使用 vi.waitFor 处理异步条件async-concurrent-expect - 在并发测试中使用测试上下文的 expectasync-act-wrapper - 等待用户事件以避免 act 警告async-error-handling - 正确测试异步错误处理setup-beforeeach-cleanup - 在 afterEach 钩子中清理状态setup-restore-mocks - 在每个测试后恢复模拟setup-avoid-shared-state - 避免测试间共享可变状态setup-beforeall-expensive - 对昂贵的一次性设置使用 beforeAllsetup-reset-modules - 测试模块状态时重置模块setup-test-factories - 对复杂的测试数据使用测试工厂mock-vi-mock-hoisting - 理解 vi.mock 的提升行为mock-spyon-vs-mock - 恰当选择 vi.spyOn 与 vi.mockmock-implementation-not-value - 对动态模拟使用 mockImplementationmock-msw-network - 使用 MSW 模拟网络请求mock-avoid-overmocking - 避免过度模拟mock-type-safety - 在模拟中保持类型安全mock-clear-between-tests - 在测试间清除模拟状态perf-pool-selection - 为性能选择合适的池perf-disable-isolation - 在安全时禁用测试隔离perf-happy-dom - 尽可能使用 happy-dom 而非 jsdomperf-sharding - 在 CI 并行化中使用分片perf-run-mode-ci - 在 CI 环境中使用运行模式perf-bail-fast-fail - 在 CI 中使用 bail 实现快速失败snap-inline-over-file - 对小值优先使用内联快照snap-avoid-large - 避免大型快照snap-stable-serialization - 确保稳定的快照序列化snap-review-updates - 提交前审查快照更新snap-describe-intent - 为快照测试起描述性名称env-per-file-override - 需要时按文件覆盖环境env-setup-files - 对全局配置使用设置文件env-globals-config - 一致地配置全局变量env-browser-api-mocking - 模拟测试环境中不可用的浏览器 APIassert-specific-matchers - 使用特定匹配器而非通用匹配器assert-edge-cases - 测试边界情况和边界值assert-one-assertion-concept - 每个测试只测试一个概念assert-expect-assertions - 对异步测试使用 expect.assertionsassert-toequal-vs-tobe - 正确选择 toBe 与 toEqualorg-file-colocation - 将测试文件与源文件放在一起org-describe-nesting - 使用 describe 块进行逻辑分组org-test-naming - 编写描述性的测试名称org-test-skip-only - 恰当地使用 skip 和 only阅读各个参考文件以获取详细解释和代码示例:
test-tdd 技能test-msw 技能typescript 技能如需包含所有规则详情的完整指南:AGENTS.md
每周安装数
424
仓库
GitHub 星标数
85
首次出现
2026 年 1 月 22 日
安全审计
安装于
gemini-cli347
opencode347
cursor344
codex342
claude-code330
github-copilot325
Comprehensive performance optimization and best practices guide for Vitest testing framework. Contains 44 rules across 8 categories, prioritized by impact to guide test writing, refactoring, and code review.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Async Patterns | CRITICAL | async- |
| 2 | Test Setup & Isolation | CRITICAL | setup- |
| 3 | Mocking Patterns | HIGH | mock- |
| 4 | Performance | HIGH | perf- |
| 5 | Snapshot Testing | MEDIUM | snap- |
| 6 | Environment | MEDIUM | env- |
| 7 | Assertions | LOW-MEDIUM | assert- |
| 8 | Test Organization | LOW | org- |
async-await-assertions - Await async assertions to prevent false positivesasync-return-promises - Return promises from test functionsasync-fake-timers - Use fake timers for time-dependent codeasync-waitfor-polling - Use vi.waitFor for async conditionsasync-concurrent-expect - Use test context expect in concurrent testsasync-act-wrapper - Await user events to avoid act warningsasync-error-handling - Test async error handling properlysetup-beforeeach-cleanup - Clean up state in afterEach hookssetup-restore-mocks - Restore mocks after each testsetup-avoid-shared-state - Avoid shared mutable state between testssetup-beforeall-expensive - Use beforeAll for expensive one-time setupsetup-reset-modules - Reset modules when testing module statesetup-test-factories - Use test factories for complex test datamock-vi-mock-hoisting - Understand vi.mock hoisting behaviormock-spyon-vs-mock - Choose vi.spyOn vs vi.mock appropriatelymock-implementation-not-value - Use mockImplementation for dynamic mocksmock-msw-network - Use MSW for network request mockingmock-avoid-overmocking - Avoid over-mockingmock-type-safety - Maintain type safety in mocksmock-clear-between-tests - Clear mock state between testsperf-pool-selection - Choose the right pool for performanceperf-disable-isolation - Disable test isolation when safeperf-happy-dom - Use happy-dom over jsdom when possibleperf-sharding - Use sharding for CI parallelizationperf-run-mode-ci - Use run mode in CI environmentsperf-bail-fast-fail - Use bail for fast failure in CIsnap-inline-over-file - Prefer inline snapshots for small valuessnap-avoid-large - Avoid large snapshotssnap-stable-serialization - Ensure stable snapshot serializationsnap-review-updates - Review snapshot updates before committingsnap-describe-intent - Name snapshot tests descriptivelyenv-per-file-override - Override environment per file when neededenv-setup-files - Use setup files for global configurationenv-globals-config - Configure globals consistentlyenv-browser-api-mocking - Mock browser APIs not available in test environmentassert-specific-matchers - Use specific matchers over generic onesassert-edge-cases - Test edge cases and boundariesassert-one-assertion-concept - Test one concept per testassert-expect-assertions - Use expect.assertions for async testsassert-toequal-vs-tobe - Choose toBe vs toEqual correctlyorg-file-colocation - Colocate test files with source filesorg-describe-nesting - Use describe blocks for logical groupingorg-test-naming - Write descriptive test namesorg-test-skip-only - Use skip and only appropriatelyRead individual reference files for detailed explanations and code examples:
test-tdd skilltest-msw skilltypescript skillFor the complete guide with all rules expanded: AGENTS.md
Weekly Installs
424
Repository
GitHub Stars
85
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli347
opencode347
cursor344
codex342
claude-code330
github-copilot325
Vue.js测试最佳实践:Vue 3组件、组合式函数、Pinia与异步测试完整指南
3,700 周安装
SaaS财务指标速查表:收入、CAC、LTV等关键公式与基准快速查阅
414 周安装
iOS WidgetKit 开发指南:构建主屏幕、锁屏、灵动岛小组件与实时活动
414 周安装
web-haptics:为Web应用添加触觉反馈的JavaScript库,支持React、Vue、Svelte框架
414 周安装
PyTorch深度学习开发专家 | Transformer、扩散模型、LLM开发指南与最佳实践
414 周安装
OMX:OpenAI Codex CLI 多智能体编排工具,实现AI驱动开发工作流自动化
414 周安装
MAESTRO:AI驱动的精英软件架构治理框架 - 提升代码质量与项目连续性
414 周安装