vue-testing-best-practices

Guide Vue 3 testing with Vitest, Vue Test Utils, and Playwright.

1|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/kirklin/skills --skill vue-testing-best-practices-kirklin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-testing-best-practices
Source: https://github.com/kirklin/skills/tree/main/skills/vue-testing-best-practices
Command: npx skills add https://github.com/kirklin/skills --skill vue-testing-best-practices-kirklin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Vue component and composable testing in Vue 3 can be brittle without coherent guidelines. This section outlines pain points in testing setups, how to structure tests for reliability, and how to avoid implementation-detail tests.

Core Features & Use Cases

  • Guidance for unit, component, and composable testing in Vue 3 projects using Vitest and Vue Test Utils.
  • Patterns for reliable asynchronous testing, mocking, and handling special features like Teleport, Suspense, and Pinia stores.
  • Real-world workflows and recommended practices for integrating Playwright-based E2E tests with the Vue testing pipeline.

Quick Start

Install Vitest, Vue Test Utils, and begin applying blackbox testing patterns to Vue components today.

Frequently Asked Questions about vue-testing-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Vue 3 composables and components without relying on implementation details?

Vue 3 component testing is more reliable using blackbox testing patterns, which focus on inputs and outputs rather than internal logic. This approach prevents brittle tests by avoiding implementation-detail checks and validating actual user behavior.

What is the best way to test Pinia stores in a Vue 3 project?

Testing Pinia stores involves using specific testing patterns to isolate store state and actions within your Vue 3 project. Proper Pinia store testing ensures your state management logic functions correctly under various conditions without leaking state between tests.

How do I handle Suspense and asynchronous components when testing Vue 3 applications?

Handling Suspense for async components requires specific asynchronous testing patterns to ensure your Vue 3 application tests resolve properly. Proper async handling guarantees that your test suite waits for component dependencies to load before asserting outcomes.

Does Vue testing work with Vitest and Vue Test Utils for E2E tests?

Vue testing integrates Vitest and Vue Test Utils for unit and component tests, while supporting Playwright-based E2E tests. This combination provides a comprehensive testing pipeline, allowing you to validate everything from individual components to full user workflows.

Why should I avoid snapshot-only tests in my Vue testing setup?

Avoiding snapshot-only tests is a recommended Vue testing best practice because they often fail to validate actual component behavior and can pass with broken outputs. Combining blackbox testing patterns with proper assertions ensures your test suite catches meaningful regressions.

Can I use Vue Test Utils to mock Teleport and other special features in Vitest?

Vue Test Utils provides patterns for mocking special features like Teleport within your Vitest testing pipeline. Proper mocking of these features ensures your component tests accurately simulate DOM rendering and behavior without breaking the test environment.