vue-testing-best-practices

仓库创建 2026年1月28日最近提交 1 个月前SkillHot 收录 22 天前
▸ 精选理由

帮助构建稳定的单元与端到端测试策略

这个 Skill 做什么

Vue 测试最佳实践,涵盖 Vitest、Vue Test Utils 与 Playwright E2E。

提供 Vue 3 项目的测试策略和实战建议,包括用 Vitest、Vue Test Utils 做组件测试,以及用 Playwright 做 E2E。什么时候派上用场?在搭建测试基础设施、写可维护的组件测试或排查间歇性失败时最需要。特点是强调黑盒式组件测试、合理的 mocking 与抗重构性,帮你把测试从易碎的实现细节中解放出来。

▸ 展开 SKILL.md 英文原文

Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.

开发编程测试VitestE2E通用
5.7k
Stars
313
Forks
19
仓库内 Skill
+188
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/antfu/skills/main/skills/vue-testing-best-practices/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/antfu/skills/main/skills/vue-testing-best-practices/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
Vue.js testing best practices, patterns, and common gotchas.

### Testing
- Setting up test infrastructure for Vue 3 projects → See [testing-vitest-recommended-for-vue](reference/testing-vitest-recommended-for-vue.md)
- Tests keep breaking when refactoring component internals → See [testing-component-blackbox-approach](reference/testing-component-blackbox-approach.md)
- Tests fail intermittently with race conditions → See [testing-async-await-flushpromises](reference/testing-async-await-flushpromises.md)
- Composables using lifecycle hooks or inject fail to test → See [testing-composables-helper-wrapper](reference/testing-composables-helper-wrapper.md)
- Getting "injection Symbol(pinia) not 
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有