Need help to test pinia store using router #2239
Unanswered
jbaubree
asked this question in
Help and Questions
Replies: 1 comment
-
Hi, I just had the exact same problem. What solved it for me was to add a fake app (as is actually described in the Pinia documentation in the Testing section), like so:
Because according to the documentation without an app, plugins (in this case the router) will not actually be added to pinia. |
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
-
I am using pinia with vite-ssg.
My pinia module is configured like this
I can use this.router.push function in my store and all works perfectly.
I need to test with vitest this store so i use this test:
Unfortunately i get an error running test "Cannot read properties of undefined (reading 'push')" from this.router.push function.
Can someone help me to configure pinia.router in test mode ?
Beta Was this translation helpful? Give feedback.
All reactions