SKILL.md
readonly只读
name
vue-testing-best-practices
description
用于 Vue.js 测试。涵盖 Vitest、Vue Test Utils、组件测试、模拟、测试模式以及用于端到端测试的 Playwright。
version
1.0.0
Vue.js 测试最佳实践、模式及常见陷阱。
测试
- 为 Vue 3 项目搭建测试基础设施 → 参见 testing-vitest-recommended-for-vue
- 重构组件内部逻辑时测试经常失败 → 参见 testing-component-blackbox-approach
- 测试因竞态条件间歇性失败 → 参见 testing-async-await-flushpromises
- 使用生命周期钩子或 inject 的组合式函数测试失败 → 参见 testing-composables-helper-wrapper
- 测试中出现 "injection Symbol(pinia) not found" 错误 → 参见 testing-pinia-store-setup
- 带有异步 setup 的组件在测试中无法渲染 → 参见 testing-suspense-async-components
- 快照测试在功能损坏时仍然通过 → 参见 testing-no-snapshot-only
- 为 Vue 应用选择端到端测试框架 → 参见 testing-e2e-playwright-recommended
- 测试需要验证计算样式或真实 DOM 事件 → 参见 testing-browser-vs-node-runners
- 测试使用 defineAsyncComponent 创建的组件失败 → 参见 async-component-testing
- Teleported 模态框内容在 wrapper 查询中找不到 → 参见 teleport-testing-complexity






