vue-test-utils: Problems after upgrading to beta.12
Version
1.0.0-beta.12
Reproduction link
https://gitlab.com/bugreports/vue-test-utils-beta.12-problems
Steps to reproduce
Run the tests as detailed in the README.
What is expected?
No errors or warnings when running unit tests.
What is actually happening?
Getting errros like:
console.error node_modules/vue/dist/vue.common.js:580
[Vue warn]: Unknown custom element: <v-btn> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in <Root>)
I had no troubles with older versions of vue-test-utils. These warnings and errors started when I upgraded to vue-test-utils.1.0.0-beta.12. No code changed anywhere. Just upgraded vue-test-utils and ran the tests again.
It may be related to this change: https://github.com/vuejs/vue-test-utils/commit/9381736
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 20 (13 by maintainers)
I just upgraded to beta.13 and it breaks
@Y0hy0h Yes, I believe so.
I can’t pinpoint the change that started logging warnings (or was suppressing them), but they are valid warnings caused by unregistered components.
I’m going to close this as the desired behavior. If people have issues with the localVue, you can create a new issue with a minimal reproduction. Thanks.
@drsensor See my previous comment 😄
@robcresswell That’s an interesting point. I still think that a default global Vue (or equivalent) with the option for a local override is a good compromise, but I now understand what you were getting at. 😉 I definitely do not seem to be registering the components in a clean way, which I will have a look at.
However, I still believe that using the same Vue instance as the app is a good way to go by default, if you have the option of overriding it with a local instance when you need to. This would make it easy to test initially, and once you need to get your hands dirty because of some implementation details, you can.
I don’t see the harm, but I would like to hear where I might be wrong and learn. 😃