-
Notifications
You must be signed in to change notification settings - Fork 669
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
TypeError: Cannot read property 'installed' of undefined when using localVue.use(<PLUGIN>) #822
Comments
You need to import default exports using namespace imports:
You would get the same error if you tried to call We could improve the error handling in Vue and Vue Test Utils to warn that a plugin is undefined. |
Sorry for not getting back to you sooner. I'm still having new problems. The ones with VueRouter seem to be fixed with the asterisk import (which I think is a little bit weird). However a bunch of new ones arise, these ones having to do with VeeValidate:
This error I fixed it by adding in my ;(VueTestUtils.config.mocks as any)['validationErrors'] = () => {
has: () => {}
} However I get a similar error in another component:
And I think It has to do when I use
Which I think it might have to do with this issue: logaretm/vee-validate#1267 |
I'm closing this issue since the original question is resolved. If you are still having problems veeValidate, please create a new issue with a reproduction |
Hi! I'm having the same issue: Whatever plugin I use I've got this message, I've tried to import it like you said: This is very frustating! Do you have any idea or solution to this? Thanks! |
Hi @Deraw- it's difficult to answer your question without a reproduction that I can run. It could be caused by multiple issues. If you are able to provide a reproduction, and you believe that it is a bug please open a new issue in this repo. If you don't think it's a bug but would like to understand what the issue is, please post a question on StackOverflow |
Hi @eddyerburgh! Thanks for your response, I've created a repo that reproduce the issue and opened #1061! |
This is the same issue with importing in TypeScript. On solution is to turn on {
"compilerOptions": {
"esModuleInterop": true
// ..
}
// ..
} Take a look at this StackOverflow answer https://stackoverflow.com/a/43622363/4939630 |
@eddyerburgh Thank you for the quick answer, it worked! |
How can I define the compilerOptions? |
@AdrianHL You define it in your |
I have created the tsconfig.json file in both, the project root folder and in the folder containing the test cases. Same error. Also tried to update the content of the file so it contains invalid data and there are no errors so I guess it is not loading it :( This is how I run the tests
Edit: Fixed by changing |
I've already this esModuleInterop equals true, but I continue to receive the same error for Vuetify. |
I have a same error too, "esModuleInterop" is "true" |
Version
1.0.0-beta.20
Reproduction link
https://github.com/cesalberca/vue-test-utils-bug
Steps to reproduce
Update vue-test-utils to 1.0.0-beta.20 and run tests.
What is expected?
No errors.
What is actually happening?
Every test that uses localVue.use fails with the following error:
I don't know if it's related but I can't use Vue.extend() in order to mount a directive in another Vue instance:
If I move ComponentClass inside the directive (which won't work as expected) I still get cannot read
extend of undefined
.I think Vue has a lot of potential, but if you guys want to get the attention of big companies I really think you should offer first class support with TypeScript –which is used a lot in big projects–, and I don't think right now that is achieved. Anyway, tell me anything that you need and I will offer all the help that is required and thank you for your time.
The text was updated successfully, but these errors were encountered: