-
Notifications
You must be signed in to change notification settings - Fork 668
Can't find functional component with shallowMount #1813
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
Comments
I will have to verify but I believe this is a known limitation, at least with Vuetify's functional components, due to how they are composed. This may (or may not) be the case for all functional components, because they do not have an instance (vm) and are just compiled to regular HTML elements. The way I've generally handled this is using a Lots of potential issues, I am not sure which one is the cause here. Potentially related issues:
I have tried to solve this many times before and had no luck, I'm sorry but I don't know if I will be able to look into this one. Vuetify and shallowMount have cost me many hours. If you find a work-around, please post here so others can benefit. If you find a solution, let me know! |
I found a way how to fix find by component constructor (first case in my example). The cause of the issue was the fact that original VIcon component used in tested component is differ from component imported in test. That's because of strange vuetify setup. (check this commit Djaler/vue-test-utils-functional-components-shallow-mount@b4aa817) |
Also, I have a fix for second case in my example - find component by name. Check this #1817 |
Fixed in #1817 |
Can you release this, please? |
https://github.com/vuejs/vue-test-utils/releases/tag/v1.1.4 Let me know if you have any problems with the release. |
is this fix applied to vue test utils version 2 (for vue3) as well? |
It should work with VTU v2 just fine, please file an issue in that repo if it does not. |
Subject of the issue
If I mount my component using
shallowMount
, I can't find functional components inside it.Steps to reproduce
https://github.com/Djaler/vue-test-utils-functional-components-shallow-mount
npm install
)npm run test
)Expected behaviour
Icon component should be found and both tests should pass
Actual behaviour
Icon component not found in both cases
The text was updated successfully, but these errors were encountered: