npm / @vue/test-utils
@vue/test-utils
What changed in @vue/test-utils 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
4 breaking4 new APIs and options1 behavior and defaults1 tooling42 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@vue/test-utils 252 changes
Breaking changes 4
Plain object and array props are no longer made deeply reactive. Wrap values in reactive() before mounting or pass a new value to setProps; already-reactive props stay reactive.
Vue Test Utils no longer supports class components.
Legacy Mutation Event listener entries are dropped.
Browser and require export definitions are switched.
New APIs and options 4
Adds TeleportStub and support for custom components as built-in stubs.
Adds VueWrapper.emit.
The GlobalMountOptions type is exported.
The Stubs type is exposed publicly.
Behavior and default changes 1
The
vmreturned byfindComponentexposesdefineExposebindings.
Tooling 1
Emitted event names and payload types are inferred.
Fixes and other changes 42
attachTo is supported on Vue versions before 3.5.
attributes() now keeps the namespace prefix in attribute names.
Directives registered with camelCase or kebab-case names can now be stubbed.
Events emitted during unmount are cleared from emitted history, and events are recorded only once when a devtools hook is installed.
Element and component lookup now works inside multi-root functional components.
Selector lookup works when the root component is functional.
findComponent no longer crashes when a ref points to an SVG element.
Global mocks are applied even when named after internal instance fields.
mount now accepts union-typed props.
Mounting option slots called outside render no longer produce a warning.
setData now keeps Map and Set values.
Slots passed to a stubbed teleport or keep-alive are now rendered.
Stubs now retain props from mixins and extends.
Stubs no longer crash on props without primitive conversion.
Globally registered components can be stubbed by their registration key.
Stubs are now applied only to the app being rendered.
The content of a teleport stubbed with a component is now updated.
Resolved types for defaulted wrapper props are now inferred.
Fixes types for findComponent with generic SFCs.
Emitted event history for child components is cleared on unmount.
The root component continues re-rendering after another wrapper is mounted.
Corrects the behavior of the
summaryelement.keydown and keyup events set a spec-compliant event.code.
setData() is handled correctly for components using both setup() and data().
Restores text() and html() for single-root components.
Cleanup now tolerates duplicate attachTo cleanup.
Corrected the declaration entrypoint.
Keyboard events preserve their code value.
FunctionalComponent<any> is accepted as a selector.
Mount option slots are compatible with noUncheckedIndexedAccess set to true.
setData() and shallowMount with initialData support components using the Composition API and <script setup>.
text() now includes content for array functional components.
Unmounting removes the wrapper div.
The missing @vue/compiler-dom peer dependency is added.
Fixes the emitted events cache.
Fixes module resolution for ESM files.
Allows finding top-level components.
Passes props to functional components.
Fixes comparison of reactive prop objects.
Fixes string slots with a null context in renderFn.
Fixes wrapper.element for components with nested multiple roots.
Fixes wrapper.element for components with a slot.