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

[QUESTION] How to write tests for components that use @nuxt/icon #197

Closed
gaisinskii opened this issue Jul 10, 2024 · 5 comments
Closed

[QUESTION] How to write tests for components that use @nuxt/icon #197

gaisinskii opened this issue Jul 10, 2024 · 5 comments

Comments

@gaisinskii
Copy link

gaisinskii commented Jul 10, 2024

Hello everyone!

I've stumbled upon an error while writing tests for my components that use nuxt/icon, specifically:

[Vue warn]: Component <NuxtIcon>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered. 

I've found in the docs of the testutils that you have to somehow wrap either NuxtIcon or MyComponent with <Suspense/> and it is also unclear how to import NuxtIcon into the test file since we use <Icon/> in the markup. Can you please show me how to write tests when using nuxt/icon ?

I've created a reproduction setup, after installing all deps it will auto start the test and you will see the error.

https://stackblitz.com/edit/nuxt-vitest-iocqwn

Best regards

@gaisinskii gaisinskii changed the title [QUESTION] How to write test for components what use @nuxt/icon [QUESTION] How to write test for components that use @nuxt/icon Jul 10, 2024
@gaisinskii gaisinskii changed the title [QUESTION] How to write test for components that use @nuxt/icon [QUESTION] How to write tests for components that use @nuxt/icon Jul 10, 2024
@gaisinskii
Copy link
Author

Anyone? Am I the only one bothered by this warning ?

@awacode21
Copy link

i am also in trouble. The Icon component does not get rendered in my cypress component test. Did you found any way to get your problem solved?

@gaisinskii
Copy link
Author

awacode21

I just ditched the library :/

@antfu
Copy link
Member

antfu commented Aug 16, 2024

I will work on it and provide a template / guide to it later

@antfu antfu closed this as completed in 5724416 Aug 20, 2024
@antfu
Copy link
Member

antfu commented Aug 20, 2024

I did it in 5724416, it seems that directly following https://nuxt.com/docs/getting-started/testing would work, no specific steps required.

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

3 participants