Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add unit test guide. #738

Closed
1 task done
myan9527 opened this issue Sep 22, 2023 · 3 comments
Closed
1 task done

Please add unit test guide. #738

myan9527 opened this issue Sep 22, 2023 · 3 comments

Comments

@myan9527
Copy link

myan9527 commented Sep 22, 2023

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=""/> inside MyComp

Could you please provide some helpful tutorial about this?

@Justineo
Copy link
Member

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

@myan9527
Copy link
Author

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

@Justineo
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants