Skip to content

Child component using Vue.extends not receiving global $state property from Vuex #382

@chriscasola

Description

@chriscasola

Version

1.0.0-beta.10

Reproduction link

https://jsfiddle.net/7t28dy1u/

Steps to reproduce

Run the fiddle - console error because this.$store is undefined on the child component.

What is expected?

All child components should receive the global $store mixin from Vuex.

What is actually happening?

Only the root element is receiving the $store property.


I can fix the jsbin by removing the Vue.extend notation and just passing the raw javascript objects into mount. I also confirmed that this works as expected when using Vue to construct the component normally (not using vue-test-utils).

I ran into this because I was using ES6 imports to import my store into all my app components. I switched to using this.$store which works fine in the app, but broke a lot of my unit tests that were using vue-test-utils to mount the components.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions