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.

O método exists

Afirma que o Wrapper (envolvedor) existe.

Retorna false se chamando em um Wrapper o qual não existe.

  • Retorna: {boolean}

  • Exemplo:

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

const wrapper = mount(Foo)
expect(wrapper.exists()).toBe(true)
expect(wrapper.find('does-not-exist').exists()).toBe(false)