MCPInstall

vue-test-utils-skilld

ALWAYS use when writing, debugging, or reviewing code that imports "@vue/test-utils" or mentions vue test-utils, VTU, mount, shallowMount, findComponent, wrapper queries, or migrating from Vue Test Utils v1. Provides the current API surface, mounting options, wrapper methods, and testing recipes for @vue/test-utils 2.5.1 on Vue 3.

Installs
167
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vue-test-utils-skilld
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads vue-test-utils-skilld automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

@vue/test-utils 2.5.1 (Vue 3)

Prepared source: input/source, version 2.5.1 (package.json:3). Requires Vue 3.x and @vue/compiler-dom 3.x as peers; @vue/server-renderer 3.x is an optional peer needed only for renderToString (package.json:73-81). Test-runner agnostic (Vitest, Jest, others). Needs a browser-like DOM environment (jsdom or happy-dom).

Install: npm install @vue/test-utils --save-dev

Quick start

import { mount } from '@vue/test-utils'
import Counter from './Counter.vue'

test('increments', async () => {
  const wrapper = mount(Counter, { props: { start: 1 } })
  await wrapper.find('button').trigger('click')
  expect(wrapper.text()).toContain('2')
})

Public API surface

Exports from dist/src/index.d.ts:13:

ExportKindUse
mountfunctionMount a component, returns VueWrapper (dist/src/mount.d.ts:17)
shallowMountfunctionSame as mount with all child components stubbed (dist/src/mount.d.ts:22)
renderToStringfunctionSSR-render a component to a string, Promise<string> (dist/src/renderToString.d.ts:4)
flushPromisesfunctionAwait pending non-Vue promises (mocked API calls, timers) (dist/src/utils/flushPromises.d.ts:1)
enableAutoUnmount(hook)functionUnmount all wrappers via a test hook (dist/src/utils/autoUnmount.d.ts:4)
disableAutoUnmountfunctionStop auto unmounting (dist/src/utils/autoUnmount.d.ts:3)
VueWrapperclassWrapper around a mounted component instance (dist/src/vueWrapper.d.ts:5)
DOMWrapperclassWrapper around a DOM element; new DOMWrapper(document.body) (dist/src/domWrapper.d.ts:4)
RouterLinkStubcomponentStub for <router-link> (dist/src/components/RouterLinkStub.d.ts:1)
configobjectShared default mount options and wrapper plugins (dist/src/config.d.ts:32)
createWrapperErrorfunctionInternal; produces the error wrapper returned by find misses

Core rules

  • await every method that returns a promise: trigger, setValue, setProps, setData, renderToString, flushPromises. Without await, assertions run before the DOM updates.
  • Use get() / getComponent() when the element must exist; they throw on miss. Use find() / findComponent() only when absence is a valid outcome; they return an error wrapper whose exists() is false.
  • find() accepts CSS selectors only. To locate a child component use findComponent(Component), findComponent({ name: 'Foo' }), findComponent({ ref: 'foo' }), or a CSS selector.
  • Register enableAutoUnmount(afterEach) once in test setup to prevent state leaks between tests.
  • Use flushPromises() for promises Vue does not track (mocked HTTP clients, setTimeout).
  • wrapper.vm only reliably exposes what the component exposes: options-API state, defineExpose() bindings (since 2.5.0, PR #2927), or setup() return values.
import { enableAutoUnmount } from '@vue/test-utils'
import { afterEach } from 'vitest'

enableAutoUnmount(afterEach)

Version notes: 2.4.10 -> 2.5.1

Earlier v2 milestones still relevant

Migrating from v1 (Vue 2)

Full table: migration reference, official guide https://test-utils.vuejs.org/migration/

  • propsData -> props; createLocalVue removed -> global.plugins / global.mixins
  • mocks, stubs, provide, directives moved under global
  • destroy() -> unmount(); findAll().at(i) -> findAll()[i] (returns an array)
  • createWrapper() removed -> new DOMWrapper(el)
  • setChecked / setSelected removed -> merged into setValue
  • find() no longer finds components by name; use findComponent
  • shallowMount no longer renders default slot content of stubs; restore with config.global.renderStubDefaultSlot = true
  • Removed: is, isEmpty, isVueInstance, name, setMethods, contains, scopedSlots (merged into slots)

Best practices

  • Prefer mount with targeted global.stubs over shallowMount. Shallow tests assert structure, not behavior, and stubbed children hide real interactions. https://test-utils.vuejs.org/guide/advanced/stubs-shallow-mount
  • If you do stub broadly, set config.global.renderStubDefaultSlot = true so default slot content of stubs still renders (dist/src/types.d.ts:125-131).
  • Stub directives with the vName key: global.stubs: { vTooltip: true } or pass a replacement directive object.
  • <transition> and <transition-group> are stubbed by default (dist/src/types.d.ts:120-124); custom transition stubs are supported.
  • Pass inject values through global.provide, matching production injection. For typed injection keys, wrap the key: provide: { [injectionKey as symbol]: value }.
  • Test composables by mounting a minimal host component and reading state from wrapper.vm.
  • Wrap components with async setup() in a <Suspense> host before mounting.
  • For <Teleport>, either stub it (global.stubs: { teleport: true }) or create the target element in beforeEach and query it with document.querySelector. https://test-utils.vuejs.org/guide/advanced/teleport
  • Use RouterLinkStub when testing around <router-link> without installing a router: global.stubs: { 'router-link': RouterLinkStub }.

References

  • Mounting options and config: every mount / shallowMount / renderToString option, global.*, and the config object.
  • Wrapper API: every VueWrapper / DOMWrapper method with signatures.
  • Migration v1 -> v2: full option and method mapping plus 2.5.x changes.
  • Testing recipes: forms, v-model, emitted events, router, Vuex/Pinia, Suspense, Teleport, SSR.

FAQ

What does the vue-test-utils-skilld skill do?

ALWAYS use when writing, debugging, or reviewing code that imports "@vue/test-utils" or mentions vue test-utils, VTU, mount, shallowMount, findComponent, wrapper queries, or migrating from Vue Test Utils v1. Provides the current API surface, mounting options, wrapper methods, and testing recipes for @vue/test-utils 2.5.1 on Vue 3.

How do I install vue-test-utils-skilld?

Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vue-test-utils-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/vue-test-utils-skilld/ (personal) or .claude/skills/vue-test-utils-skilld/ (project).

Which AI agents can use vue-test-utils-skilld?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is vue-test-utils-skilld safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains vue-test-utils-skilld?

It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 167 recorded installs.

More from skilld-dev/vue-ecosystem-skills

View all →

quasar-skilld

skilld-dev/vue-ecosystem-skills

Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.

Frontend & Design661 installs

vue-i18n-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design401 installs

vue-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design397 installs

vuetify-skilld

skilld-dev/vue-ecosystem-skills

Vue Material Component Framework. Use when writing, debugging, or configuring code that imports vuetify v4.x. Covers createVuetify setup, components and labs, composables, theming, icons, dates and locale, styles and SASS variables, treeshaking, and v3 to v4 migration.

Frontend & Design380 installs

pinia-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design313 installs

vue-router-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design285 installs

Popular frontend & design skills

View category →

setup-matt-pocock-skills

mattpocock/skills

Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.

Frontend & Design1.1M installs

frontend-design

anthropics/skills

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

OfficialFrontend & Design1M installs

hyperframes-animation

heygen-com/hyperframes

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

prototype

mattpocock/skills

Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

Frontend & Design999.2K installs

hyperframes-core

heygen-com/hyperframes

The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Frontend & Design930.5K installs

vercel-react-best-practices

vercel-labs/agent-skills

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

OfficialFrontend & Design843.1K installs