Please add unit test guide.
myan9527 opened this issue · 3 comments
myan9527 commented
Confirmation
- I can confirm this is a feature request for the Vue component instead of ECharts itself.
Details
I'm unit testing vue-echart with version 6.5.4, and my test code as following:
it("should render page", async () => {
const wrapper = mount(MyComp, {
props: {
name: "name",
data: [...]
}
})
expect(wrapper).not.to.be.null
expect(wrapper).contains(VChart).to.be.true
})
Error occurs running this test case:
[Vue warn]: Component is missing template or render function.
at <Anonymous option= {....
More detail:
- Test framework: vitest
- Using
<v-chart option=""/>
insideMyComp
Could you please provide some helpful tutorial about this?
Justineo commented
Testing should be no different from other components. I don't think we have anything special to add.
myan9527 commented
确实有所不同,mount VChart组件都不能正确被渲染。
还是要考虑一下常见单元测试工具的集成吧,毕竟还是有人会关注的。
Justineo commented
Sounds more like a bug with your testing library as it should support mounting any valid Vue component.