vue-testing-best-practices

Standardize Vue 3 component and Playwright-based E2E testing with Vitest and Vue Test Utils patterns.

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/trcat/ai-todo-list --skill vue-testing-best-practices-trcat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-testing-best-practices
Source: https://github.com/trcat/ai-todo-list/tree/main/.agents/skills/vue-testing-best-practices
Command: npx skills add https://github.com/trcat/ai-todo-list --skill vue-testing-best-practices-trcat

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill standardizes and improves Vue 3 component testing by providing practical guidance for Vitest, Vue Test Utils, component testing patterns, mocking, and Playwright for E2E testing.

Core Features & Use Cases

  • Testing infrastructure setup: guidance on configuring Vitest, Vue Test Utils, and test runners for Vue 3 projects.
  • Blackbox testing patterns: emphasis on testing behavior over implementation details and using data-testid where needed.
  • Async & composables: best practices for testing async setup, Suspense, and composables with provide/inject and Pinia stores.
  • E2E considerations: overview of Playwright-based end-to-end testing and cross-browser considerations.
  • Quality & maintenance: strategies to avoid flaky tests, snapshot usage, and selecting testing approaches.

Quick Start

Use this skill to guide your Vue 3 project’s testing strategy, set up Vitest, and begin building robust tests following the described patterns.

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 set up Vue 3 component testing with Vitest and Vue Test Utils?

To set up Vue 3 component testing with Vitest, you need to configure Vitest alongside Vue Test Utils to establish your test runner. This skill provides guidance on configuring the testing infrastructure to start building robust tests for your project.

What is the best way to test Vue 3 composables that use provide/inject and Pinia stores?

The best way to test Vue 3 composables with provide/inject and Pinia stores is following behavioral testing patterns. This skill provides best practices for testing async setup, Suspense, and composables to ensure reliable integration.

How does blackbox testing apply to Vue components and when should I use data-testid?

Blackbox testing in Vue components emphasizes testing behavior over implementation details. You should use data-testid attributes where needed to reliably locate elements without coupling tests to internal structure.

Can I use Playwright for Vue 3 E2E testing and handle cross-browser considerations?

Yes, you can use Playwright for Vue 3 E2E testing to handle end-to-end scenarios. This skill provides an overview of Playwright-based testing and cross-browser considerations for comprehensive coverage.

How to avoid flaky tests and manage snapshot testing in Vitest for Vue projects?

To avoid flaky tests in Vitest, you should follow quality and maintenance strategies that minimize timing issues and brittle selectors. This skill offers guidance on proper snapshot usage and selecting effective testing approaches.

Does this Vue testing approach work with async setup and Suspense components?

Yes, this Vue testing approach works with async setup and Suspense components by providing specific best practices. It covers testing patterns for asynchronous operations to ensure your component rendering behaves correctly.