Why always force the injection of pinia symbol during component tests? #958
Unanswered
LuisMiguelFilipe
asked this question in
Help and Questions
Replies: 0 comments
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.
-
Hello,
I recently switched to Pinia.
In my project I never call
useStore
inside.vue
files.Instead I have a composable file which does it internally.
In my test of a Vue Component I am doing
setActivePinia
but notcreateTestingPinia
from `@pinia/testing'All my composable-only tests work fine with
setActivePinia
only.As far as I understand, since I do not invoke
useStore
from.vue
filesI pin-pointed the behavior to this line
https://github.com/vuejs/pinia/blob/v2/packages/pinia/src/store.ts#L859
Shouldn't we check, beforehand, if an activePinia is already defined?
because on line
871
we are simply assigningpinia = activePinia
I actually tried to comment out that line of code and my test actually passes!
I guess I am missing some part of a bigger plan?
Could someone shed some light on the matter?
Beta Was this translation helpful? Give feedback.
All reactions