V
vue-testing-best-practices
About vue-testing-best-practices
A reference skill for testing Vue.js applications, covering setup choices and common testing pitfalls. It is intended for Vue developers working with components, composables, and end-to-end tests.
Key features
- 01Vue 3 test setup guidance
- 02Black-box component testing
- 03Async and lifecycle test patterns
- 04Pinia and Suspense setup
- 05Browser versus Node runner guidance
Use cases
- 01Choosing a Vue test infrastructure
- 02Testing composables that use injection
- 03Diagnosing flaky asynchronous tests
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ antfu/ skills --skill vue-testing-best-practicesAfter installing, type/vue-testing-best-practicesin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
LICENSE.mdSYNC.mdreference/async-component-testing.mdteleport-testing-complexity.mdtesting-async-await-flushpromises.mdtesting-browser-vs-node-runners.mdtesting-component-blackbox-approach.mdtesting-composables-helper-wrapper.mdtesting-e2e-playwright-recommended.mdtesting-no-snapshot-only.mdtesting-pinia-store-setup.mdtesting-suspense-async-components.mdtesting-vitest-recommended-for-vue.mdDetails
From the project READMEVue.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
Comments
Markdown supported