Last active
October 7, 2018 05:05
-
-
Save crshmk/2ce439961e0e5137233d6948711b1282 to your computer and use it in GitHub Desktop.
vue-test-utils mounting functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { m, sm, mountWithPlugin } from './utils.js' | |
// reduce mounting boilerplate | |
import Component from '@/views/Comp.vue' | |
const wrapper = m(Component) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { shallowMount, mount, RouterLinkStub, createLocalVue } from '@vue/test-utils' | |
import somePlugin from 'some-plugin' | |
export function m(component) { | |
return mount(component, {stubs: {RouterLink: RouterLinkStub}}) | |
} | |
export function sm(component) { | |
return shallowMount(component, {stubs: {RouterLink: RouterLinkStub}}) | |
} | |
const localVue = createLocalVue() | |
localVue.use(somePlugin) | |
export function mountWithPlugin(component) { | |
return mount(component, { localVue, stubs: {RouterLink: RouterLinkStub}}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment