You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
Hi everyone,
I am setting up tests on a
Nuxt2
app using@nuxtjs/composition-api
and@vue/test-utils
.In addition, there is a
vue-CLI
UI library using@vue/composition-api
andvue-demi
.The issue is that even if the context is mocked as per solution here, our store is still
undefined
and the tests are failling.///// SET UP /////
The
Nuxt2
app is set as follow:Package.json
nuxt.config.js
jest.config.js
test/vueSetup.js
///// Component and Test ////
Component.vue
test.spec.js
There were a couple of attempts to define/ mock the store globally:
vueSetup.js
setting a mock store globaly
config.mocks.store
adding $nuxt to Vue.prototype
But all of it result in the same error as in the title:
TypeError: Cannot destructure property 'store' of '(0 , _compositionApi.useContext)(...)' as it is undefined.
So what else could be done in order to not have an
undefined
store and be able to run the tests properly?Vuex
be added (which sounds not good as it is a nuxt app)$t
and$tc
works fine?Many thanks in advance for your support and please let me know if there is any missing information or if you need more details.
Cheers,
The text was updated successfully, but these errors were encountered: