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.

Components

Vue Test Utils includes utility components you can use to stub components.

RouterLinkStub

A component to stub the Vue Router router-link component.

You can use this component to find a router-link component in the render tree.

  • Usage:

To set it as a stub in mounting options:

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

const wrapper = mount(Component, {
  stubs: {
    RouterLink: RouterLinkStub
  }
})
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/some/path')