What problem does it solve?
Writing unit tests for Vue 3 applications that use Pinia stores often leads to brittle, implementation-coupled tests or incorrect mocking setups. This Skill guides the creation and review of behavior-first tests for components, composables, and stores using Vitest, Vue Test Utils, and createTestingPinia.
Core Features & Use Cases
- Pinia Test Setup Guidance: Applies the correct createTestingPinia configuration for each scenario, including action spies, stubActions, initialState seeding, plugin injection, and getter overrides.
- Behavior-First Test Authoring: Drives tests through public inputs like props, DOM events, and store APIs, asserting observable outputs instead of internal implementation details.
- Test Review: Flags brittle selectors, implementation-coupled assertions, missing coverage, and incorrect Pinia setups during code review.
- Use Case: When adding tests for a Vue component that reads from and dispatches to a Pinia store, use this Skill to mount the component with createTestingPinia, seed initial state, trigger user-like interactions, and assert emitted events and store changes.
Quick Start
Write unit tests for my Vue 3 component that uses a Pinia store, following behavior-first patterns with Vitest and createTestingPinia.