Vitest and Pinia reactivity not working when running multiple tests #2255
Unanswered
wasimTQ
asked this question in
Help and Questions
Replies: 1 comment 3 replies
-
This seems to be related to vueuse, not pinia. BTW you shouldn't use a global state with pinia as pinia already makes its state global. I suspect the global state you are creating is being reused across tests. With pinia, each each test should have its own |
Beta Was this translation helpful? Give feedback.
3 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.
-
I'm testing my custom store built with
createGlobalState
fromvueuse
. I'm using a watcher to watch for changes in pinia's getter to manipulate value in my store.For some context:
cardExpandedDialogStore
is a pinia storecardNavigation
is a custom storecardExpandedDialogStore.open()
when I call this function it modifies the store valuesdialogIsVisible, expandedCard
that's used inside the custom store to manipulate values.The problem is it works perfect when I'm only running that test suite with
it.only
. And not working when running multiple test suites.When running the single test suite alone, the response for
console.log(currentIndex.value, currentCardId.value) // These are from cardNavigation
is1 'd66ee8a8-c650-42b7-bbe0-7c8761473b45'
.But when running multiple test suites other tests are passing but only two tests that calls the
open
function is failing and the console log of the above in0
I know I should've explained it better. But I don't know how. And I can't share much of codes that's protected by NDA. Let me know if you can help me solve it.
Beta Was this translation helpful? Give feedback.
All reactions