with one click
vue-test-utils-skilld
// ALWAYS use when writing code importing "@vue/test-utils". Consult for debugging, best practices, or modifying @vue/test-utils, vue/test-utils, vue test-utils, vue test utils, test-utils, test utils.
// ALWAYS use when writing code importing "@vue/test-utils". Consult for debugging, best practices, or modifying @vue/test-utils, vue/test-utils, vue test-utils, vue test utils, test-utils, test utils.
Vue port for Radix UI Primitives. ALWAYS use when writing code importing "reka-ui". Consult for debugging, best practices, or modifying reka-ui, reka ui.
Modern and scalable routing for Vue applications. ALWAYS use when writing code importing "@tanstack/vue-router". Consult for debugging, best practices, or modifying @tanstack/vue-router, tanstack/vue-router, tanstack vue-router, tanstack vue router, router.
A user-empowering data visualization Vue 3 components library for eloquent data storytelling. ALWAYS use when writing code importing "vue-data-ui". Consult for debugging, best practices, or modifying vue-data-ui, vue data ui.
Hooks for managing, caching and syncing asynchronous and remote data in Vue. ALWAYS use when writing code importing "@tanstack/vue-query". Consult for debugging, best practices, or modifying @tanstack/vue-query, tanstack/vue-query, tanstack vue-query, tanstack vue query, query.
The framework agnostic core of FormKit. ALWAYS use when writing code importing "@formkit/core". Consult for debugging, best practices, or modifying @formkit/core, formkit/core, formkit core, formkit.
Renderless components for VueUse. ALWAYS use when writing code importing "@vueuse/components". Consult for debugging, best practices, or modifying @vueuse/components, vueuse/components, vueuse components, vueuse.
| name | vue-test-utils-skilld |
| description | ALWAYS use when writing code importing "@vue/test-utils". Consult for debugging, best practices, or modifying @vue/test-utils, vue/test-utils, vue test-utils, vue test utils, test-utils, test utils. |
| metadata | {"version":"2.4.10","generated_at":"2026-05-01T00:00:00.000Z","references_synced_at":"2026-05-01T00:00:00.000Z"} |
@vue/test-utils@2.4.10Tags: 2.0.0-alpha.0: 2.0.0-alpha.0, 2.0.0-alpha.1: 2.0.0-alpha.1, 2.0.0-alpha.2: 2.0.0-alpha.2
References: Docs
This section documents version-specific API changes โ prioritize recent major/minor releases.
BREAKING: propsData โ v2 renamed to props for consistency with component definitions source
BREAKING: createLocalVue โ removed in v2, use the global mounting option to install plugins, mixins, or directives source
BREAKING: mocks and stubs โ moved into the global mounting option in v2 as they apply to all components source
BREAKING: destroy() โ renamed to unmount() in v2 to match Vue 3 lifecycle naming source
BREAKING: findAll().at() โ removed in v2; findAll() now returns a standard array of wrappers source
BREAKING: createWrapper() โ removed in v2, use the new DOMWrapper() constructor for non-component elements source
BREAKING: shallowMount โ v2 no longer renders default slot content for stubbed components by default source
BREAKING: find() โ now only supports querySelector syntax; use findComponent() to locate Vue components source
BREAKING: setSelected and setChecked โ removed in v2, functionality merged into setValue() source
BREAKING: attachToDocument โ renamed to attachTo in v2 source
BREAKING: emittedByOrder โ removed in v2, use emitted() instead source
NEW: renderToString() โ added in v2.3.0 to support SSR testing source
NEW: enableAutoUnmount() / disableAutoUnmount() โ replaces enableAutoDestroy in v2 source
DEPRECATED: scopedSlots โ removed in v2 and merged into the slots mounting option source
Also changed: setValue() and trigger() return nextTick ยท slots scope exposed as params in string templates ยท is, isEmpty, isVueInstance, name, setMethods, and contains removed
await methods that return nextTick (trigger, setValue, setProps, setData) to ensure DOM updates are processed before running assertions source// Preferred
await wrapper.find('button').trigger('click')
expect(wrapper.text()).toContain('Count: 1')
// Avoid โ assertion runs before DOM update
wrapper.find('button').trigger('click')
expect(wrapper.text()).toContain('Count: 1')
Prefer get() and getComponent() over find() and findComponent() when you expect the element to exist โ they throw immediately if not found, providing clearer test failures source
Use flushPromises() to resolve non-Vue asynchronous operations such as mocked API calls (axios) or external promise-based logic that Vue doesn't track source
Enable enableAutoUnmount(afterEach) in your test setup to automatically clean up wrappers after every test, preventing state pollution and memory leaks source
import { enableAutoUnmount } from '@vue/test-utils'
import { afterEach } from 'vitest'
enableAutoUnmount(afterEach)
Wrap components with async setup() in a <Suspense> component within your test to correctly handle their asynchronous initialization source
Enable config.global.renderStubDefaultSlot = true when using shallow mounting to ensure content within default slots is rendered for verification source
Prefer mount() with specific global.stubs over shallow: true to keep tests more production-like while still isolating specific complex child components source
Use global.provide to pass data to components using inject, ensuring the component tree's dependency injection works as it does in production source
Test complex composables by mounting a minimal TestComponent that calls the composable, allowing you to verify internal state via wrapper.vm source
const TestComponent = defineComponent({
setup() {
return { ...useMyComposable() }
}
})
const wrapper = mount(TestComponent)
expect(wrapper.vm.someValue).toBe(true)
vName naming convention (e.g., vTooltip: true) in the global.stubs mounting option source