Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 651 Bytes

createLocalVue.md

File metadata and controls

28 lines (19 loc) · 651 Bytes

createLocalVue()

  • Returns:

    • {Component}
  • Usage:

createLocalVue returns a Vue class for you to add components, mixins and install plugins without polluting the global Vue class.

Use it with options.localVue:

import { createLocalVue, shallowMount } from '@vue/test-utils'
import Foo from './Foo.vue'

const localVue = createLocalVue()
const wrapper = shallowMount(Foo, {
  localVue,
  mocks: { foo: true }
})
expect(wrapper.vm.foo).toBe(true)

const freshWrapper = shallowMount(Foo)
expect(freshWrapper.vm.foo).toBe(false)