router-link not resolved in unit test #2184
-
Hey folks, I would appreciate some help with this. I'm using const router = createRouter({
history: createWebHashHistory(),
routes,
})
const screen = render(OverviewPage, {
global: {
plugins: [router],
},
})
screen.debug() Before, it printed like this: <body>
<a
class=""
href="#/?locale=de-CH"
hreflang="de"
>
German
</a>
<a
class=""
href="#/?locale=fr-CH"
hreflang="fr"
>
French
</a>
<a
class=""
href="#/?locale=it-CH"
hreflang="it"
>
Italian
</a>
</body> Now, it prints this: <body>
<router-link
hreflang="de"
to="/?locale=de-CH"
>
German
</router-link>
<router-link
hreflang="fr"
to="/?locale=fr-CH"
>
French
</router-link>
<router-link
hreflang="it"
to="/?locale=it-CH"
>
Italian
</router-link>
</body> I really don't know if I'm doing anything wrong. Why is the
Dependencies:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The warning you mentioned would seem to indicate that you have two copies of Vue included in your project. One copy is providing the You could try deleting |
Beta Was this translation helpful? Give feedback.
The warning you mentioned would seem to indicate that you have two copies of Vue included in your project. One copy is providing the
resolveComponent
function, while the other is running the component rendering. That leads toresolveComponent
believing it is being run outside ofrender
.You could try deleting
node_modules
and reinstalling, though that may not help if both versions are listed in the lock file. Commands likenpm list vue
andnpm why vue
could also help to establish what copies of Vue are present.