-
Notifications
You must be signed in to change notification settings - Fork 668
Problems calling createLocalVue #312
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
Normally you don't use the real Vuex store in your tests, since Can you post the entire code (component, module file)? There might be a better alternative that using your actual Vuex store. Or, if you post all the code, we can find the conflict. I write a lot about this here, you can take a look there, or I can help you work through testing your component here. |
Are you able to provide a minimal reproduction? |
Thanks guys, I'll provide some more code later today. @lmiller1990 Thanks for the post, but yeah I'm not trying to use the real Vuex store and as you can see in my test spec I'm trying to create a local Vue to mock it (I didn't include the However, Webpack seems to still need to bundle all the other components that depend on Vuex, and there's some conflict going on somewhere when I call |
Potentially this is caused by a previously installed plugin. We should add a |
@eddyerburgh I have wrapped
Actually doing a reproduction may be a little more complicated, so before I do that, do you know of any existing examples of vue-test-utils+mocha-webpack+vuex? @eddyerburgh The closest I see is your example but it uses Karma. Maybe I can compare my setup to existing examples to get ideas to solve my problem However, I updated the original question with a little more info that may spark some ideas. |
We're having a similar issue. I'll try and get a repro to you guys tomorrow to see if you can help us (and @gsccheng ) |
@ross2411 Preliminarily it looks like it's caused by Vue Material:
Are you using that library too? |
I'm going to close this as it sounds like its an issue with the plugin you're using. Feel free to open a new issue with a reproduction if you'd like more input (I could create an issue in the plugin repo if I have a reproduction). You can use this JSFiddle as a template for the repro—Can you create a full reproduction using this JSFiddle as a starting point—https://jsfiddle.net/eddyerburgh/2mzsL00d/4/ |
Sorry been slow to respond. We're using vuetify and suspect the problems lies there too |
Same using the |
I'm trying to set up some unit tests with Vuex according to the instructions to mock with modules. I'm using mocha-webpack.
However, I'm getting an error like the person is having here.
So in my test spec:
I think there's some collision with
Vue.use(Vuex)
during bootstrap? But, it's not easy for me to separate that and the components usage of it during my tests cases.My
package.json
test script looks like thisUPDATE WITH MORE INFO
My problem may have something to do with how webpack is not resolving index.js correctly from the directory name.
This configuration results in the
charAt
error I listed above. However, it still remains true that if I excludecreateLocalVue()
I get no problems and tests are able to run fine.This configuration (when I change to
import { foo } from "../../../libs/foo"
works fine with all my tests running successfully.Here's my webpack config. I have no issues running the code in other environments (e.g. development, production).
The text was updated successfully, but these errors were encountered: