SKILL.md
只读
名称
vue-testing-best-practices
描述
用于 Vue.js 测试。涵盖 Vitest、Vue Test Utils、组件测试、Mock 模拟、常用测试模式,以及使用 Playwright 进行 E2E 端到端测试。
版本
1.0.0
Vue.js 测试最佳实践、设计模式与常见踩坑指南。
测试
- 为 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
- 测试需要验证计算样式(computed styles)或真实 DOM 事件 → 参见 testing-browser-vs-node-runners
- 测试通过 defineAsyncComponent 创建的组件时失败 → 参见 async-component-testing
- 经过 Teleport 传送的弹窗内容在 wrapper 查询中找不到 → 参见 teleport-testing-complexity






