feat: add wrapper option and configure API - #29
Conversation
Add provider-agnostic wrapper support per render and via configure(), with rerender and emitted() targeting the component under test.
Remove out-of-scope NoSlotProvider fixture, add JSDoc on configure, document vitest-browser-react parity in README, and tighten edge-case tests.
Move the vitest-browser-react parity reference to the PR description.
|
@sheremet-va Hi, do you know if someone could review this? |
sheremet-va
left a comment
There was a problem hiding this comment.
Implementation seems fine to me, but there are a few rough edges
|
|
||
| export { render, cleanup, config } from './pure' | ||
| export type { ComponentRenderOptions, RenderResult } from './pure' | ||
| export { render, cleanup, config, configure } from './pure' |
There was a problem hiding this comment.
I am concerned about two things that are called very similarly, can we combine them?
There was a problem hiding this comment.
I've renamed the second one to be dissimilar, don't hesitate if you have another suggestion about that
| } | ||
| ``` | ||
|
|
||
| ### Wrapper |
There was a problem hiding this comment.
The docs live in the vitest repo: https://vitest.dev/api/browser/vue.html
There was a problem hiding this comment.
Removed. Gonna open an PR if the PR gets merged
Avoid confusion between Vue Test Utils `config` and vitest-browser-vue global render config.
Keep detailed wrapper documentation in the canonical vitest.dev docs.
92f187e to
53f4858
Compare
|
Hi @sheremet-va Just a quick follow-up on this MR. I've addressed all the review comments, so whenever you have a chance, could you please take another look? Thanks! |
Summary
Parity with
vitest-browser-reactwrapperoption.wrapperrender option to wrap the component under test in a provider componentconfigure({ wrapper })for global wrapper setup in Vitest setup filesrerender()andemitted()target the component under test when a wrapper is usedMotivation
Consumers currently need custom helpers to wrap components in providers (
UApp,ElConfigProvider, etc.) and to fixrerender/emittedbehavior with manual wrappers.Test plan
pnpm lintpnpm buildpnpm testNotes