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.


Deprecation warning

Using get to search for a Component is deprecated and will be removed. Use getComponent instead.

Works just like find but will throw an error if nothing matching the given selector is found. You should use find when searching for an element that may not exist. You should use this method when getting an element that should exist and it will provide a nice error message if that is not the case.

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

const wrapper = mount(Foo)

// similar to `wrapper.find`.
// `get` will throw an error if an element is not found. `find` will do nothing.

expect(() => wrapper.get('.does-not-exist'))
    'Unable to find .does-not-exist within: <div>the actual DOM here...</div>'