【发布时间】:2021-12-28 16:33:51
【问题描述】:
当我尝试使用wrapper.findComponent 时,我收到以下错误:
ErrorWrapper { 选择器: { ref: 'loginTab' } }
我在网上搜索过,但无济于事。这是我的测试代码:
describe('Sign-Up Test Cases', () => {
const wrapper = mount(SignUp, {
methods: {
getProv: jest.fn()
},
localVue
})
it('Dialog contains a Login Input Field', () => {
console.log(wrapper.findComponent({ ref: 'loginTab' }))
expect(wrapper.findComponent({ ref: 'loginTab' }))
})
})
localVue 已定义。
检查我使用findComponent 函数的it 语句。
更新:我尝试了其他方法。
我试过了,没用。
import Vuetify, {VTab} from 'vuetify/lib'
// Some Code here
console.log(wrapper.findComponent(VTab))
它没有工作。我收到以下错误:
ErrorWrapper {selector: [Function: VueComponent]}
【问题讨论】:
标签: vue.js unit-testing jestjs vue-test-utils