vue-testing-best-practices

Guide Vue 3 unit, component, and end-to-end testing with Vitest, Vue Test Utils, and Playwright.

Updated Dec 30, 2025
One-click install
npx skills add https://github.com/NKDShinKu/NKDShinKu --skill vue-testing-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-testing-best-practices
Source: https://github.com/NKDShinKu/NKDShinKu/tree/main/.agents/skills/vue-testing-best-practices
Command: npx skills add https://github.com/NKDShinKu/NKDShinKu --skill vue-testing-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Vue applications often struggle with testing quality, leading to flaky results and slow feedback loops. This Skill provides practical, battle-tested patterns for unit, component, and end-to-end testing in Vue 3 projects, with guidance on mocks, test structure, and debugging.

Core Features & Use Cases

  • Structured guidance for Vue 3 unit and component testing using Vitest and Vue Test Utils.
  • End-to-end testing patterns with Playwright, including reliable setup and test organization.
  • Common gotchas & best practices addressing async updates, Teleport, and store integration in tests.
  • Use Case: Teams adopting Vue 3 can incrementally raise test reliability and coverage with minimal boilerplate.

Quick Start

Install Vitest, Vue Test Utils, and Playwright, configure a basic test suite, and run tests to validate Vue components and E2E flows.

Frequently Asked Questions about vue-testing-best-practices

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

FAQPage Schema
What's the best way to structure Vue 3 component testing with Vitest?

Vue 3 component testing with Vitest is best structured using Vue Test Utils to mount components and validate isolated logic. This skill provides structured patterns to minimize boilerplate and ensure reliable, fast feedback loops across your test suite.

How do I set up Playwright for end-to-end testing in a Vue application?

Setting up Playwright for Vue end-to-end testing involves configuring reliable test execution flows and logical test organization. This skill provides practical patterns for E2E setup to validate user journeys without the flakiness common in real-world projects.

Why does my Vue test suite fail due to async updates and Teleport?

Vue test suites often fail due to async updates and Teleport because DOM mutations occur out of sync with test assertions. This skill addresses these common gotchas by providing practical examples to handle async behavior and Teleport targets correctly.

Do I need external services to run Vue component tests with Vue Test Utils?

You do not need external services to run Vue component tests with Vue Test Utils and Vitest. This skill assumes standard npm-based tooling, allowing you to validate components and execute tests locally with minimal infrastructure setup.

How do I handle mocking in Vue 3 testing to avoid flaky results?

Mocking in Vue 3 testing requires isolating component dependencies to avoid flaky results and slow feedback loops. This skill offers structured guidance on using mocks effectively within Vitest to maintain test reliability and coverage incrementally.