Testing mocking a store, Error: You must configure the createSpy
option.
#1096
-
Reproduction
Steps to reproduce the behaviorI created a simple repo to show the problem.
Expected behaviorPass the tests Actual behaviorThe tests are failing: FAIL src/components/tests/HelloWorld.spec.js > HelloWorld > renders properly Additional informationMaybe there is something I'm doing wrong... But I didn't figured out what it is. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
If you hover the createSpy option when providing it, it I’ll show you an example of what you need to do |
Beta Was this translation helpful? Give feedback.
-
I finally solved my problem. I think that because I'm not using Jest, i need to provide a So the solution is, first import
Then inject inside
It seems easy now, but I was completely lost at the moment... I think it should be on the documentation because now it's the default scaffold when you init a Vue3 project. |
Beta Was this translation helpful? Give feedback.
-
There is a better solution, just add
|
Beta Was this translation helpful? Give feedback.
I finally solved my problem.
I think that because I'm not using Jest, i need to provide a
createSpy
parameter when I usecreateTestingPinia
plugin.So the solution is, first import
fn
from vitest:Then inject inside
createTestingPinia
:It seems easy now, but I was completely lost at the moment... I think it should be on the documentation because now it's the default scaffold when you init a Vue3 project.