'Vue test can't find store in child components

I have a parent component and there are several child components. Some children use Vuex store. When I try to mount parent component like below in Vue test, I'm getting an error "Cannot read state of undefined" in child components.

const store = new Vuex.Store({
    modules: {
      local: localStore
    },
  });

wrapper = mount(ParentComponent, {
      localVue,
      i18n,
      propsData,
      store,
      attachTo: document.body,
    });

I am sending a mock store in the mount. But it seems child component will not have access to it. How to mount a parent component with a child component that uses store?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source