_vuex.default.store 不是构造函数
_vuex.default.store is not a constructor
我正在尝试测试一个在其中使用 vuex 的组件,我正在尝试传递相应组件的存储以便它可以组装,但我收到以下错误:
_vuex.default.store 不是构造函数
我不知道发生了什么,我在互联网上找不到任何帮助我的东西,如果有人能帮助我,我将不胜感激!
规格文件
import {shallowMount,createLocalVue} from '@vue/test-utils'
import Vuex from 'vuex'
import sateliteComponent from '@/components/satelite/listaSatelite.vue'
import sateliteStore from '@/core/modules/satelite/index.js'
var vueWithVuex = createLocalVue()
vueWithVuex.use(Vuex)
const store = new Vuex.store({
sateliteStore
})
describe('testes componente satelite', () => {
test('instanciado', () => {
const wrapper = shallowMount(sateliteComponent,{
localVue:vueWithVuex,
store
})
expect(wrapper.isVueInstance()).toBeTruthy()
});
});
如有必要,我可以post我正在渲染的组件
更正:
const store = new Vuex.Store({
sateliteStore
})
应该Vuex.Store
检查word store的大小写
对于其他访问者:
即使使用正确的大小写,如果您尝试使用
也会出现此错误
new Vuex.Store()
之前 运行
Vue.use(Vuex)
我正在尝试测试一个在其中使用 vuex 的组件,我正在尝试传递相应组件的存储以便它可以组装,但我收到以下错误:
_vuex.default.store 不是构造函数
我不知道发生了什么,我在互联网上找不到任何帮助我的东西,如果有人能帮助我,我将不胜感激!
规格文件
import {shallowMount,createLocalVue} from '@vue/test-utils'
import Vuex from 'vuex'
import sateliteComponent from '@/components/satelite/listaSatelite.vue'
import sateliteStore from '@/core/modules/satelite/index.js'
var vueWithVuex = createLocalVue()
vueWithVuex.use(Vuex)
const store = new Vuex.store({
sateliteStore
})
describe('testes componente satelite', () => {
test('instanciado', () => {
const wrapper = shallowMount(sateliteComponent,{
localVue:vueWithVuex,
store
})
expect(wrapper.isVueInstance()).toBeTruthy()
});
});
如有必要,我可以post我正在渲染的组件
更正:
const store = new Vuex.Store({
sateliteStore
})
应该Vuex.Store
检查word store的大小写
对于其他访问者:
即使使用正确的大小写,如果您尝试使用
也会出现此错误new Vuex.Store()
之前 运行
Vue.use(Vuex)