SKILL.md
只读
名称
vue-testing-best-practices
描述
适用于 Vue.js 测试。涵盖 Vitest、Vue Test Utils、组件测试、Mock 模拟、测试模式以及使用 Playwright 进行 E2E 测试的最佳实践。
版本
1.0.0
Vue.js 测试最佳实践、常见模式与踩坑指南。
Testing
- 为 Vue 3 项目搭建测试基础设施 → 参见 testing-vitest-recommended-for-vue
- 重构组件内部实现时测试频繁报错挂掉 → 参见 testing-component-blackbox-approach
- 测试因竞态条件导致偶发性失败 → 参见 testing-async-await-flushpromises
- 使用了生命周期钩子或 inject 的 Composable 无法正常测试 → 参见 testing-composables-helper-wrapper
- 测试中抛出 "injection Symbol(pinia) not found" 报错 → 参见 testing-pinia-store-setup
- 包含异步 setup 的组件在测试中无法渲染 → 参见 testing-suspense-async-components
- 功能已经坏了但快照测试依然顺利通过 → 参见 testing-no-snapshot-only
- 为 Vue 应用选择合适的端到端(E2E)测试框架 → 参见 testing-e2e-playwright-recommended
- 测试需要校验计算样式或真实的 DOM 事件 → 参见 testing-browser-vs-node-runners
- 使用 defineAsyncComponent 创建的组件测试失败 → 参见 async-component-testing
- Teleport 传送弹窗的内容在 wrapper 查询中找不到 → 参见 teleport-testing-complexity






