-
Notifications
You must be signed in to change notification settings - Fork 1
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
Slots are not working #4
Comments
I stumbled upon this issue too and tried adding a new testcase to the repository: test/fixtures/Slot.vue <template>
<slot />
<slot name="footer" />
</template> test('renders comonent with slot', async () => {
render(Slot, {
slots: {
default: 'Default',
footer: 'Footer',
},
})
await expect.element(page.getByText('Default')).toBeVisible()
await expect.element(page.getByText('Footer')).toBeVisible()
}) Which passes. As soon as I add this to our vitest browser testsuite at fails, with the same error reported above. 🤔 |
Vue testing ecosystem relies a lot on Node.js and CJS development condition for this type of thing. I am not sure how to fix this on our side yet, but for now you can add this to your aliases and it should fix it:
|
When rendering slots, it throws this error:
I am testing with this setup:
TestComponent.vue
TestComponent.browser.test.ts
While writing this issue I finally found a way which works:
So I needed to transform it into a function. Is this a bug or is this supposed to work like this? If this is not a bug then there should be some instructions on your documentation how to use the slots, since the slot declarations which are written in Vue Test Utils documentation do not work.
The text was updated successfully, but these errors were encountered: