-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
beforeCreated hook not called sometimes #8441
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
This doesn't look related to vue core. If you think it is please remove all the other dependencies from the repro. You may want to open an issue in vue-test-utils instead of vuex if the error only happens in test environment |
@posva I think that this bug is indeed related to vue core as it is vue which handles calling the |
The minimal possible, so no test environment, no external libraries. It can be in a jsfiddle (http://jsfiddle.net/posva/wsr78d2w/). |
Indeed! Ignore that 🙂 |
I created an issue in vue-test-utils now as I suppose this might be related to how they mount the components. I still suspect vue core to be the underlying problem, however I guess it'd be better to first eliminate the test utilities to be the problem. |
I can confirm that the problem is with Vue Test Utils, and how components extend from the localVue constructor |
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 worsk fine.Hints
This issue might be related to vue-test-utils instead. I had a look at whether vue-jest could be related to this issue but it doesn't seem to.
This issue might be the underlying issue for vuex#1330.
The text was updated successfully, but these errors were encountered: