Nuxt 3 + Vitest: how to test a component that uses a store? --> defineStore is not defined #2283
Unanswered
Jeroen-Cox
asked this question in
Help and Questions
Replies: 1 comment
-
youn need mount instead of render |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Working with Nuxt3, composition api and I'm trying to create a component test for my login page with Vitest.
I followed the docs: https://pinia.vuejs.org/cookbook/testing.html#unit-testing-components but I keep running into problem after problem.
I think for this test I should not care about the implementation of the component, all I need to test is:
This is my test code:
The error I get is "defineStore is not defined" inside of my store file. This is the relevant part of my store file:
What do I have to do so that my component test can use the testing store?
Beta Was this translation helpful? Give feedback.
All reactions