All skills
skilld-dev avatar

/vue-test-utils-skilld

@b9c39cb

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.

Use this Skill: https://skilld.dev/gh/skilld-dev/vue-ecosystem-skills/vue-test-utils-skilld

This session only. Nothing lands on disk.

referencesmigration-v2.md

≈807 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Migration: v1 -> v2, and 2.5.x changes

Official migration guide: https://test-utils.vuejs.org/migration/

Mounting options

v1 v2
propsData props (alias still works, deprecated: dist/src/types.d.ts:33-35)
localVue + createLocalVue removed; use global.plugins, global.mixins, global.directives
mocks, stubs, provide, mixins, plugins, components, directives nested under global
attachToDocument attachTo (Element or CSS selector)
scopedSlots removed; use slots for everything
context, listeners, parentComponent removed

Wrapper methods

v1 v2
destroy() unmount()
setChecked(), setSelected() merged into setValue()
emittedByOrder emitted()
contains() find(...).exists()
is(), isEmpty(), isVueInstance(), name(), setMethods() removed
createWrapper(el) new DOMWrapper(el)
findAll(...).at(i) findAll(...)[i]; returns a plain array
find(NameSelector) for components findComponent(Component | { name } | { ref } | css); find() is CSS-only
findAllComponents({ ref }) unsupported; use data-test attributes and CSS selectors
enableAutoDestroy enableAutoUnmount(afterEach) (since 2.0.0-rc.16)

Behavioral changes to watch

  • shallowMount no longer renders default slot content of stubbed components. Restore with config.global.renderStubDefaultSlot = true.
  • shallowMount stub tags are kebab-case: hello-world-stub, not helloworld-stub.
  • String slot templates read scoped data from params: slots: { default: '<p>{{ params.id }}</p>' }.
  • In string slot templates, props no longer refers to slot scope.
  • trigger() and setValue() return nextTick; v1 returned synchronously in some paths.

2.5.x

2.4.x late fixes

2.2.0 - 2.3.0 additions

Source: SKILL.md on GitHub

No alerts8d3 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    This skill is a comprehensive documentation and best-practices resource for @vue/test-utils, the official testing library for Vue 3. It includes API references, migration guides from Vue 2, and troubleshooting information derived from real-world GitHub issues and discussions. No malicious code or security threats were detected.

  • Socket8d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at b9c39cb. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week

README badge

README badge for skilld-dev/vue-ecosystem-skills/vue-test-utils-skilld