-
Notifications
You must be signed in to change notification settings - Fork 668
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
useSlots() make component not mountable #2033
Comments
In addition to |
Quick workaround for vitest (fixes // tests setup
vi.mock('vue', async () => {
const actualModule = await vi.importActual('vue');
return {
...actualModule,
useListeners: actualModule.default.useListeners,
};
}); |
@rossinek how does this solve the issue? This mock does not change the implementation of Unless mocking prevents inconsistent module resolution. Whilst debugging I've noticed both vitest |
@piktur thank for taking a look at this. It was a long time ago and TBH I don't remember why it works and currently I don't have the capacity to debug it once again but I created a little reproduction for you if you want to dive in. To see the difference run: npm run test src/components/HelloWorld.broken.spec.js
# vs
npm run test src/components/HelloWorld.spec.js |
Update for anyone struggling with this: Wrong:
Correct:
Currently using:
|
Subject of the issue
Given a basic component, with setup script, if we use the function
useSlots()
, the component cannot be rendered withmount
.Steps to reproduce
I created a brand new project with create-vue@2, with typescript and vitest :
Now the basic component, SlotComponent.vue :
The associated test, SlotComponent.spec.ts :
Expected behaviour
the test should pass, (it pass if i remove the code
const slots = useSlots()
)Actual behaviour
the test fail with the stacktrace below :
Annex :
my package.json :
The text was updated successfully, but these errors were encountered: