Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
hyf0 avatar

Vue Testing Best Practices

  • 2.3k installs
  • 2.8k repo stars
  • Updated May 30, 2026
  • hyf0/vue-skills

This is a copy of vue-testing-best-practices by antfu - installs and ranking accrue to the original listing.

vue-testing-best-practices is a Vue 3 testing skill that teaches developers to await flushPromises when testing defineAsyncComponent units so assertions run after async rendering completes.

About

vue-testing-best-practices is a high-impact gotcha skill from hyf0/vue-skills for Vue 3 async component testing. It explains that defineAsyncComponent loads asynchronously and Vue updates on microtasks, so tests without await flushPromises() assert before the component renders—producing false negatives. The skill tags vue3, testing, async, defineAsyncComponent, flushPromises, and vitest, and includes a task checklist for async/await test functions and proper promise flushing. Developers reach for vue-testing-best-practices when Vitest or Vue Test Utils suites flake or fail on async child components that appear blank at assertion time.

  • 5-point task checklist for testing async components with Vitest and Vue Test Utils
  • Explains correct use of await flushPromises() after mounting defineAsyncComponent
  • Demonstrates testing of loading states before flushPromises and error states with rejected promises
  • Shows proper use of trigger() with await since it returns a Promise
  • Includes before-and-after code examples that prevent false negatives in Vue 3 tests

Vue Testing Best Practices by the numbers

  • 2,265 all-time installs (skills.sh)
  • +35 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hyf0/vue-skills --skill vue-testing-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.3k
repo stars2.8k
Security audit3 / 3 scanners passed
Last updatedMay 30, 2026
Repositoryhyf0/vue-skills

Why do Vue async component tests fail falsely?

Correctly test Vue 3 async components and avoid false negatives caused by un-awaited rendering.

Who is it for?

Frontend engineers writing Vitest suites for Vue 3 apps that use defineAsyncComponent and hit timing-related false negatives.

Skip if: Teams testing purely synchronous Vue components or projects not using defineAsyncComponent, flushPromises, or Vitest.

When should I use this skill?

Vue 3 tests assert too early on defineAsyncComponent children or show false negatives before async rendering completes.

What you get

Stable Vitest tests with awaited flushPromises and reliable assertions on fully rendered async Vue components.

  • corrected async component tests
  • flushPromises test pattern

Files

SKILL.mdMarkdownGitHub ↗

Vue.js testing best practices, patterns, and common gotchas.

Testing

  • Setting up test infrastructure for Vue 3 projects → See testing-vitest-recommended-for-vue
  • Tests keep breaking when refactoring component internals → See testing-component-blackbox-approach
  • Tests fail intermittently with race conditions → See testing-async-await-flushpromises
  • Composables using lifecycle hooks or inject fail to test → See testing-composables-helper-wrapper
  • Getting "injection Symbol(pinia) not found" errors in tests → See testing-pinia-store-setup
  • Components with async setup won't render in tests → See testing-suspense-async-components
  • Snapshot tests keep passing despite broken functionality → See testing-no-snapshot-only
  • Choosing end-to-end testing framework for Vue apps → See testing-e2e-playwright-recommended
  • Tests need to verify computed styles or real DOM events → See testing-browser-vs-node-runners
  • Testing components created with defineAsyncComponent fails → See async-component-testing
  • Teleported modal content can't be found in wrapper queries → See teleport-testing-complexity

Reference

Related skills

How it compares

Reach for vue-testing-best-practices for async Vue component timing; use general Vue skills for non-test component architecture.

FAQ

Why is flushPromises required for defineAsyncComponent tests?

vue-testing-best-practices documents that defineAsyncComponent loads asynchronously and Vue schedules updates on microtasks. Without await flushPromises(), Vitest assertions run before the component renders, causing false-negative failures.

Which test stack does vue-testing-best-practices target?

vue-testing-best-practices targets Vue 3 with defineAsyncComponent, Vitest, flushPromises from Vue Test Utils, and async/await test functions for reliable component assertions.

Is Vue Testing Best Practices safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Testing & QAfrontendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.