-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript error on render with a defineComponent (v6.0) #167
Comments
Hi! Looks like you're using Vue 3! As stated in the prerelease, there's no router support yet. Also types are not updated yet to match the new |
@afontcu Thanks for your quick reply :). Concerning the router, I did a test, it is not the best experience (ts-ignore + router.ready()) but it seems to work : describe('App', () => {
test('two routes', async () => {
router.push('/')
await router.isReady() // see here : https://vue-test-utils.vuejs.org/v2/guide/vue-router.html#with-a-real-router
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
render(App, { global: { plugins: [router] } })
const elt = await screen.findByText('Home')
fireEvent.click(elt)
await screen.findByText('Welcome to Your Vue.js App')
const about = await screen.findByText('About')
fireEvent.click(about)
await screen.findByText('This is an about page')
})
}) |
This conversation might help! vuejs/test-utils#152 As soon as we find the best way to deal with vue router in vue test utils, I'll make sure it become available here, too :) |
It is great, though, that our |
#180 should fix this |
🎉 This issue has been resolved in version 6.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This should be fixed in Thanks! |
Is it possible to get this fix backpatched to version 5? I'm not able to upgrade to Vue 3 yet, but am using |
Describe the bug A clear and concise description of what the bug is.
Try to call
render()
on a component define withdefineComponent({...})
.This error is reported by typescript :
To Reproduce Steps to reproduce the behavior:
Expected behavior
No TS error
Screenshots
Related information:
@testing-library/vue
version: 6.0.0Vue
version: 3.0Relevant code or config (if any)
To throw away the error I did a shim for vue-testing--library in my project. I am not a TS expect so i do not kwnow if it is a correct shim
Thank you for this great wrapper.
I read some issues that worry me about the routing.
Can I easily use a real router with vue-testing-library ?
Sadly VTU seems to focus on the mock path :/
The text was updated successfully, but these errors were encountered: