-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Labels
Description
Environment
- Operating System: Linux
- Node Version: v18.18.0
- Nuxt Version: 3.9.3
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: npm@10.2.3
- Builder: -
- User Config: devtools
- Runtime Modules: -
- Build Modules: -
Reproduction
https://stackblitz.com/edit/github-5sxamx?file=components%2FMyComponent.nuxt.spec.ts
Describe the bug
One convenient method for verifying that a component has emitted the expected events is to pass a prop with "onX" that contain a mocked function:
const onTest = vi.fn()
render(MyComponent, {
props: { title: 'Test title', onTest},
});
expect(onTest).toHaveBeenCalled(); ✅While this works fine with the testing library render helper, Nuxt's renderSuspended fails to pass the event handler to the component:
await renderSuspended(MyComponent, {
props: { title: 'Test title', onTest },
});
expect(onTest).toHaveBeenCalled(); ❌Additional context
No response
Logs
No response
Reactions are currently unavailable