我对测试很陌生,我试图为我的Vue应用程序编写一些单元测试。问题是,最关键的是没有产出,我不知道出了什么问题。任何帮助都是必要的。
describe('UserForm', () => {
it('renders component properly', async () => {
const viewId = "123"
render(UserForm, {
props: {
open: true
}
})
const view = await screen.findByText('Kontrahent')
expect(view.id).toBe(viewId)
})
})我使用以下命令vitest --environment jsdom运行测试
发布于 2022-08-31 22:07:36
你有没有试过这样做:
import { mount } from "@vue/test-utils";
// in the describe
const wrapper = mount(Login, {
props: {
open: true
},
});
it("mounts the component", () => {
expect(wrapper.html()).toContain("Kontrahent");
});https://stackoverflow.com/questions/72856514
复制相似问题