We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you so much for such a great lib. I found a little bug when testing store that use this.$nuxt
this.$nuxt
TypeError: Cannot destructure property '$config' of 'this.$nuxt' as it is undefined.
Sandbox: https://codesandbox.io/s/competent-field-w3j63?file=/test/use-main-store-error.spec.js
actions
yarn test
The test should pass because $nuxt should exist in this context
$nuxt
The test throw an error
I found a little workaround in my test to avoid this error
File: https://codesandbox.io/s/competent-field-w3j63?file=/test/use-main-store-working.spec.js
beforeEach(() => { const pinia = setActivePinia(createPinia()); const contextMock = { $config: { CONFIG_1: 1 } }; pinia._p.push(({ store }) => { Object.defineProperty(store, "$nuxt", { value: contextMock }); }); });
The text was updated successfully, but these errors were encountered:
This is not a bug, you need to mock the nuxt context. I don’t know if nuxt provides something to easily mock their context though
Sorry, something went wrong.
Added to #829
No branches or pull requests
Reproduction
Thank you so much for such a great lib.
I found a little bug when testing store that use
this.$nuxt
Sandbox: https://codesandbox.io/s/competent-field-w3j63?file=/test/use-main-store-error.spec.js
Steps to reproduce the behavior
actions
usethis.$nuxt
to access the nuxt contextyarn test
Expected behavior
The test should pass because
$nuxt
should exist in this contextActual behavior
The test throw an error
Additional information
I found a little workaround in my test to avoid this error
File: https://codesandbox.io/s/competent-field-w3j63?file=/test/use-main-store-working.spec.js
The text was updated successfully, but these errors were encountered: