Component testing Vue with Pinia: "no active Pinia" error only on Github actions #31615
-
I have a problem running my test suite on Github actions (using cypress-io/github-action@v6). A handful of tests always come back with the error: Has anyone else experienced this issue, or do you have an idea what might be causing it? Edit: A clue! By deleting the Vite cache in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
In case anyone stumbles across this post, here is the solution (or work-around) that I found. I noticed that before each error, I was seeing messages from Vite like:
So I added all of these bootstrap-vue-next dependencies to the |
Beta Was this translation helpful? Give feedback.
In case anyone stumbles across this post, here is the solution (or work-around) that I found.
I noticed that before each error, I was seeing messages from Vite like:
So I added all of these bootstrap-vue-next dependencies to the
optimizeDeps
section of myvite.config.js
file, and like magic, the tests started passing. I had to take a couple of passes at this, but so far it's been reliable. My working theory is that when Vite reloads, the contents ofcomponent.js
don't get run again, thus resulting in the 'no active pinia' …