Vue 与 Pinia 单元测试
原名:unit-test-vue-pinia
为 Vue 3、TypeScript、Vitest 和 Pinia 组件及状态逻辑编写单元测试。
中文 Skills 技能说明
适合 CEOFans 等 Vue 项目补充或审查测试。先理解组件边界和真实状态变化,再设计有价值的断言与模拟;不为提高覆盖率制造没有业务意义的测试。
上游能力依据
上游原始适用说明:Write and review unit tests for Vue 3 + TypeScript + Vitest + Pinia codebases. Use when creating or updating tests for components, composables, and stores; mocking Pinia with createTestingPinia; applying Vue Test Utils patterns; and enforcing black-box assertions over implementation details.
上游 SKILL.md 主要章节(保留原文标题):
- Workflow
- Core Rules
- Pinia Testing Approach
- Default pattern for component tests
- Accepted minimal Pinia setups
- Execute real actions only when needed
- Seed store state with initialState
- Add Pinia plugins through createTestingPinia
- Getter override pattern for edge cases
- Pure store unit tests
使用边界
先复现问题并固定测试范围,再生成或执行测试。测试通过只能证明已覆盖的场景,不能代替生产环境验收。
作者、翻译与许可证
- 原作者
- GitHub, Inc. 与 awesome-copilot contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/github/awesome-copilot/tree/3f0bba475ec40b9680e1d0311b9caffeec5ad4c3/skills/unit-test-vue-pinia
适用范围
平台:linux、macos、windows;标签:测试与质量、Vue 与 Pinia 单元测试
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。