feat: add createRootOptions to ComponentRenderOptions#53
Conversation
This allows passing options to React's `createRoot` closes vitest-community#52
| container?: HTMLElement | ||
| baseElement?: HTMLElement | ||
| wrapper?: React.JSXElementConstructor<{ children: React.ReactNode }> | ||
| createRootOptions?: RootOptions |
There was a problem hiding this comment.
Can you add some jsdoc? Can leave others empty but just for this one for now.
createRootOptions to ComponentRenderOptionscreateRootOptions to ComponentRenderOptions
|
react-testing-library accepts some of these options directly: https://testing-library.com/docs/react-testing-library/api . Should we do the same? What are your thoughts, @hi-ogawa, @nstepien? It might just be outdated, and we can improve here or follow the same pattern Documentation at vitest.dev should also be updated: https://github.com/vitest-dev/vitest/blob/main/docs/api/browser/react.md |
|
Ah good catch. I didn't check what testing library did. I vote for aligning with them if no obvious reason to diverge. |
|
RTL only supports I think a separate object is better:
Those are my thoughts, I can flatten the options if you insist. 👍 Tangentially, maybe await page.hydrate(<div />, {
hydrateRootOptions: {}
}) |
hi-ogawa
left a comment
There was a problem hiding this comment.
Thanks for the thoughts. Now I'm re-approving 😄
This allows passing options to React's
createRootcloses #52