-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Version
3.1.0
Reproduction link
https://github.com/djam90/vuex-vue-router-issue
Steps to reproduce
Run npm run test:unit
and see the failure. To get the tests to run again, do not import the store into the router and the router into the store.
What is expected?
The tests should run fine and circular imports should work. They DO work in the browser just not in Mocha testing environment.
What is actually happening?
Error as follows:
TypeError: Cannot read property 'getters' of undefined
at /home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:261:1
at Array.forEach (<anonymous>)
at assertRawModule (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:260:1)
at ModuleCollection.register (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:186:1)
at /home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:200:1
at /home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:75:1
at Array.forEach (<anonymous>)
at forEachValue (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:75:1)
at ModuleCollection.register (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:199:1)
at new ModuleCollection (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:160:1)
at new Store (/home/dan/code/vuex-router-issue/dist/webpack:/node_modules/vuex/dist/vuex.esm.js:311:1)
My VueX store needs to be able to import the router so it can do routing things like navigate to another page.
My router needs to be able to access state from VueX to determine what to do in a router.beforeEach
handler.
I have asked for help on Stack Overflow:
https://stackoverflow.com/questions/54691789/unable-to-import-vuex-store-into-router-and-router-into-store-in-mocha-tests
emiliemarchand
Metadata
Metadata
Assignees
Labels
No labels