Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 666 Bytes

createLocalVue.md

File metadata and controls

28 lines (20 loc) · 666 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, shallow } from '@vue/test-utils'
import { expect } from 'chai'
import Foo from './Foo.vue'

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

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