You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For testing library providing the VueQueryPlugin works perfect. But sometimes I want to test stores / composables / etc. where I don't render, and I'd prefer not to mock vue query because I want to test what's happening inside my composable (onSuccess / onError, etc.)
Here's my setup currently:
main.ts
import { VueQueryPlugin } from "vue-query"
app.use(VueQueryPlugin)
vitest.setup.ts ( the setup file from vitest config setupFiles: "./src/testing/vitest.setup.ts", )
"if (!vm) {
throw new Error("vue-query hooks can only be used inside setup() function.");
}
"
I instead receive:
"Error: No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
The text was updated successfully, but these errors were encountered:
scottmillionnexient
changed the title
Vitest - providing when using VueQueryPlugin not working
Vitest - config.global.provide when using VueQueryPlugin not working
Oct 17, 2023
For testing library providing the VueQueryPlugin works perfect. But sometimes I want to test stores / composables / etc. where I don't render, and I'd prefer not to mock vue query because I want to test what's happening inside my composable (onSuccess / onError, etc.)
Here's my setup currently:
main.ts
vitest.setup.ts ( the setup file from vitest config setupFiles: "./src/testing/vitest.setup.ts", )
When running unit test for a composable:
Here is the composable for reference
And here's how it's used in a pinia store
If I comment out
I instead receive:
The text was updated successfully, but these errors were encountered: