Replies: 1 comment 3 replies
-
Hi, have you tried creating a localVue? I am using vue 2.6 and the following is working for us: import { createLocalVue } from "@vue/test-utils";
import { VueQueryPlugin } from "@tanstack/vue-query";
import { shallowMount } from "@vue/test-utils";
const localVue = createLocalVue();
localVue.use(VueQueryPlugin);
shallowMount(component, {
localVue,
}); |
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.
-
Hi I'm currently testing a vue component using
vue-test-utils
, but mounting the component, which hasuseInfiniteQuery
inside of it the following error appears:Error: No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.
This is strange because I've added the plugin to the mounting method as follows:
Any idea? The only solution I found is to mock the package and
useInfiniteQuery
, but working with reactive mocks isn't wonderful.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions