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

EuiIcon Error "Not supported" with @testing-library/react #2530

Closed
Dracks opened this issue Nov 14, 2019 · 3 comments
Closed

EuiIcon Error "Not supported" with @testing-library/react #2530

Dracks opened this issue Nov 14, 2019 · 3 comments

Comments

@Dracks
Copy link

Dracks commented Nov 14, 2019

Hello,

I'm doing a little electron application, and I've got problems when I try to test the interface with Elastic UI, I've got an error Not Supported, raised at the moment of render the component. (the curios thing is if you do a snapshot of the rendered, it's rendered.

You can see the error on the travis of my application:
https://travis-ci.org/Dracks/clipboard-history/builds/611942416

The repository of the application is the following:
https://github.com/Dracks/clipboard-history

I tried to use babel, on jest, as a lot of comments in internet say that should work, but, It didn't work...

Thanks!

@chandlerprall
Copy link
Contributor

Relates to #2065 which is on our 2020 Roadmap (#2520) under We want EUI on more platforms with better testing

The interesting bit (to me) about that error is the dynamic import is configured, but the requested icon doesn't exist in the expected location. Until we address #2065, the workaround for this is to mock out EuiIcon in your Jest environment with e.g. moduleNameMapper and providing an empty function component for EuiIcon.

@Dracks
Copy link
Author

Dracks commented Nov 22, 2019

Thanks,

I solved it in this commit with moduleNameMapper, creating a tricky mock of the EuiIcon. The commit is here: Dracks/clipboard-history@f167fc7 (I wish to squash all the commits, I don't know if the commit will be saved or will be removed)

@Dracks Dracks closed this as completed Nov 22, 2019
@lwolle
Copy link

lwolle commented Nov 27, 2019

@Dracks Thanks for your solution. Made my day!

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