vue-testing-best-practices
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVue.js testing best practices, patterns, and common gotchas.
Vue.js测试最佳实践、模式及常见陷阱。
Testing
测试
- Setting up test infrastructure for Vue 3 projects → See testing-vitest-recommended-for-vue
- Tests keep breaking when refactoring component internals → See testing-component-blackbox-approach
- Tests fail intermittently with race conditions → See testing-async-await-flushpromises
- Composables using lifecycle hooks or inject fail to test → See testing-composables-helper-wrapper
- Getting "injection Symbol(pinia) not found" errors in tests → See testing-pinia-store-setup
- Components with async setup won't render in tests → See testing-suspense-async-components
- Snapshot tests keep passing despite broken functionality → See testing-no-snapshot-only
- Choosing end-to-end testing framework for Vue apps → See testing-e2e-playwright-recommended
- Tests need to verify computed styles or real DOM events → See testing-browser-vs-node-runners
- Testing components created with defineAsyncComponent fails → See async-component-testing
- Teleported modal content can't be found in wrapper queries → See teleport-testing-complexity
- 为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
- 带有async setup的组件无法在测试中渲染 → 查看testing-suspense-async-components
- 功能已损坏但快照测试仍通过 → 查看testing-no-snapshot-only
- 为Vue应用选择端到端测试框架 → 查看testing-e2e-playwright-recommended
- 测试需要验证计算样式或真实DOM事件 → 查看testing-browser-vs-node-runners
- 测试使用defineAsyncComponent创建的组件失败 → 查看async-component-testing
- 在wrapper查询中找不到Teleport模态框内容 → 查看teleport-testing-complexity