provide , inject feature
navidshad opened this issue · 4 comments
navidshad commented
HI everyone
is there any way to test provide/inject feature of vue components in vue-testing-component?
sand4rt commented
Hi @navidshad, yes there is. The provide object is re-exposed from the vue-test-utils library. You can use it like the code below:
render(Component, {
global: {
provide: {
...
}
}
})
navidshad commented
oh amazing, I use typescript but this parameter is not in types
sand4rt commented
I also use TypeScript and i see that the paramater is typed. Note that provide
is wrapped with global
. Please let the author known if you found the solution so he (or you) can close the issue:)
slacktracer commented
Is this somewhere in the docs? I tried to use it as Vue Test Utils docs say it is used and they say nothing about wrapping in this global property object... 🤔