Skip to content

Component testing Vue with Pinia: "no active Pinia" error only on Github actions #31615

Closed Answered by hackel
hackel asked this question in Component Testing
Discussion options

You must be logged in to vote

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:

4:29:29 PM [vite] (client) ✨ new dependencies optimized: bootstrap-vue-next/components/BFormFile
4:29:29 PM [vite] (client) ✨ optimized dependencies changed. reloading

So I added all of these bootstrap-vue-next dependencies to the optimizeDeps section of my vite.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 of component.js don't get run again, thus resulting in the 'no active pinia' …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hackel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant