我的测试
import VueI18n from 'vue-i18n'
import Vuex from "vuex"
import iView from 'view-design'
import {mount,createLocalVue} from '@vue/test-utils'
// @ts-ignore
import FormAccountName from '@/views/forms/FormAccountName/FormAccountName'
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(iView)
localVue.use(VueI18n)
describe('a',()=>{
test('b',async ()=>{
const wrapper = mount(FormAccountName,{
localVue,
mocks: {
$t: () => 'this is a label',
formItems: {
name: '<a>'
}
},
})
expect(wrapper).toMatchSnapshot()
})
})
错误
快照正常生成,但报错
[Vue 警告]:nextTick 中的错误:“TypeError:document.createRange 不是函数”
found in
---> <Tooltip>
<ErrorTooltipTs>
<ValidationProvider>
<FormRow>
<ValidationObserver>
<FormWrapper>
<FormAccountNameUpdateTs>
<Root>
作为 iView 标签,但我已经对其进行了初始化。所以我不知道出了什么问题。有人可以帮助我吗?