You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.

To read docs for Vue Test Utils for Vue 3, click here.


Destroys a Vue component instance.

  • Example:
import { mount } from '@vue/test-utils'
import sinon from 'sinon'

const spy = sinon.stub()
  render: null,
  destroyed() {

if either the attachTo or attachToDocument option caused the component to mount to the document, the component DOM elements will also be removed from the document.

For functional components, destroy only removes the rendered DOM elements from the document.