Skip to content

feat: add wrapper option and configure API - #29

Open
ReCoN-96 wants to merge 6 commits into
vitest-community:mainfrom
ReCoN-96:feat/wrapper-option
Open

feat: add wrapper option and configure API#29
ReCoN-96 wants to merge 6 commits into
vitest-community:mainfrom
ReCoN-96:feat/wrapper-option

Conversation

@ReCoN-96

Copy link
Copy Markdown

Summary

Parity with vitest-browser-react wrapper option.

  • Add wrapper render option to wrap the component under test in a provider component
  • Add configure({ wrapper }) for global wrapper setup in Vitest setup files
  • rerender() and emitted() target the component under test when a wrapper is used

Motivation

Consumers currently need custom helpers to wrap components in providers (UApp, ElConfigProvider, etc.) and to fix rerender/emitted behavior with manual wrappers.

Test plan

  • pnpm lint
  • pnpm build
  • pnpm test

Notes

ReCoN-96 added 3 commits June 24, 2026 15:44
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.
@ReCoN-96

Copy link
Copy Markdown
Author

@sheremet-va Hi, do you know if someone could review this?

@sheremet-va sheremet-va left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation seems fine to me, but there are a few rough edges

Comment thread src/index.ts Outdated

export { render, cleanup, config } from './pure'
export type { ComponentRenderOptions, RenderResult } from './pure'
export { render, cleanup, config, configure } from './pure'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned about two things that are called very similarly, can we combine them?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed the second one to be dissimilar, don't hesitate if you have another suggestion about that

Comment thread README.md Outdated
}
```

### Wrapper

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs live in the vitest repo: https://vitest.dev/api/browser/vue.html

@ReCoN-96 ReCoN-96 Jul 2, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Gonna open an PR if the PR gets merged

ReCoN-96 added 2 commits July 2, 2026 10:37
Avoid confusion between Vue Test Utils `config` and vitest-browser-vue global render config.
Keep detailed wrapper documentation in the canonical vitest.dev docs.
@ReCoN-96
ReCoN-96 force-pushed the feat/wrapper-option branch from 92f187e to 53f4858 Compare July 2, 2026 09:26
@ReCoN-96

ReCoN-96 commented Jul 7, 2026

Copy link
Copy Markdown
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants