unit-test-vue-pinia

Solid

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.

Testing & QA 34,233 stars 4188 forks Updated today MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# unit-test-vue-pinia Use this skill to create or review unit tests for Vue components, composables, and Pinia stores. Keep tests small, deterministic, and behavior-first. ## Workflow 1. Identify the behavior boundary first: component UI behavior, composable behavior, or store behavior. 2. Choose the narrowest test style that can prove that behavior. 3. Set up Pinia with the least powerful option that still covers the scenario. 4. Drive the test through public inputs such as props, form updates, button clicks, emitted child events, and store APIs. 5. Assert observable outputs and side effects before considering any instance-level assertion. 6. Return or review tests with clear behavior-oriented names and note any remaining coverage gaps. ## Core Rules - Test one behavior per test. - Assert observable input/output behavior first (rendered text, emitted events, callback calls, store state changes). - Avoid implementation-coupled assertions. - Access `wrapper.vm` only in exceptional cases when there is no reasonable DOM, prop, emit, or store-level assertion. - Prefer explicit setup in `beforeEach()` and reset mocks every test. - Use checked-in reference material in `references/pinia-patterns.md` as the local source of truth for standard Pinia test setups. ## Pinia Testing Approach Use `references/pinia-patterns.md` first, then fall back to Pinia's testing cookbook when the checked-in examples do not cover the case. ### Default pattern for component tests Use `createTest...

Details

Author
github
Repository
github/awesome-copilot
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category