ecomfe / vue-echarts

Vue.js component for Apache ECharts™.
https://vue-echarts.dev
MIT License
9.43k stars 1.48k forks source link

Please add unit test guide. #738

Closed myan9527 closed 9 months ago

myan9527 commented 9 months ago

Confirmation

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:

Could you please provide some helpful tutorial about this?

Justineo commented 9 months ago

Testing should be no different from other components. I don't think we have anything special to add.

myan9527 commented 9 months ago

确实有所不同,mount VChart组件都不能正确被渲染。 还是要考虑一下常见单元测试工具的集成吧,毕竟还是有人会关注的。

Justineo commented 9 months ago

Sounds more like a bug with your testing library as it should support mounting any valid Vue component.