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
I had the same issue, and manage to make it work by extending the stub and mocking useLink.
But I had to move the new stub to config.global.mocks, probably because of the new mocked function? Or not? 🤔😅
// Import vue test utils functions and stubsimport{RouterLinkStub,config}from'@vue/test-utils'// Global stubsconstRouterLinkStb={ ...RouterLinkStub,useLink: vi.fn()}// Define plugins, mocks, stubs...config.global.stubs={// Stub is not working here, still the same issue "RouterLink.useLink is not a function"// RouterLink: RouterLinkStb,}config.global.mocks={// No more errors here, and tests are OKRouterLink: RouterLinkStb}
Subject of the issue
RouterLink.useLink
is missing when usingRouterLinkStub
.Steps to reproduce
VBtn
with theto
prop somewhere, e.g.MyComponent.vue
:RouterLinkStub
in a test:Expected behaviour
MyComponent
is mounted in the test, andVBtn
works.Actual behaviour
Possible Solution
Include the
RouterLink.useLink
function in the stub, since it seems to be part of the API.The text was updated successfully, but these errors were encountered: