-
Notifications
You must be signed in to change notification settings - Fork 668
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
beforeCreate hook not called sometimes #790
Comments
This happens because the component implementation is already extended imported The current implementation relies on an undocumented API in Vue core which is Maybe, we should consider different approach to achieve |
I'm open to suggestions for solving this problem with extended components and localVue |
This is especially problematic with class components in typescript as they implicitly extend the components. |
I have a PR that would replace all extended components with a new component extended from the localVue constructor (#840). This isn't an ideal solution, but I can't think of another approach right now. |
Awesome. A solution is desperately needed, especially since I found out that mocking the router is not possible without using |
Versions
Reproduction link
https://github.com/hwestphal/vue-crash-reproduce
Steps to reproduce
yarn
yarn test
What is expected?
The unit tests should pass with no errors.
What is actually happening?
The unit test fails because the value which is added to the component in the unit test
is accessed in the component in
which makes the test fail with
However, when deleting the access in the component, the asserts in the test:
pass which leads to the conclusion that after the
mount(ParentComponent, { localVue })
the hook is called while it wasn't during the mount.When removing the
Vue.extend(...)
around theSomeComponent
insrc/some-component.vue
the error disappears and everything works fine.Hints
This issues was created as vue#8441 was closed immediately after it was opened.
This issue might be related to vue instead. I had a look at whether vue-jest could be related to this issue but it doesn't seem to be.
This issue might be the underlying issue for vuex#1330.
The text was updated successfully, but these errors were encountered: