我读了3遍vue utils测试文档,也读了jest文档,但我不知道如何在vue组件中模拟vue混合并测试该组件.
我读了3遍vue utils测试文档,也读了jest文档,但我不知道如何在vue组件中模拟vue混合并测试该组件.
有两种方法:
const localVue = createLocalVue()
localVue.mixin(myMixin)
const wrapper = shallow(Post, {
localVue,
})
mixins
:const wrapper = shallow(Post, {
mixins: [myMixin],
})