chore: run tests with JSDOM and Happy DOM too - #5142
Conversation
🦋 Changeset detectedLatest commit: c84a972 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Preview deployments for this pull request: storybook - |
| const tick = async (_?: unknown) => | ||
| await new Promise((resolve) => setTimeout(resolve)); // Let MutationObserver run Loop |
There was a problem hiding this comment.
Can't we export this from somewhere? Or make it globally available in tests
There was a problem hiding this comment.
Suggest doing this in a separate PR. Maybe test this stack with cleaning up the test setup?
There was a problem hiding this comment.
Pull request overview
Expands web-component testing from real browsers to JSDOM and Happy DOM.
Changes:
- Adds JSDOM/Happy DOM Vitest projects and dependencies.
- Adds DOM compatibility patches and adapts tests.
- Removes existing coverage and JUnit reporting.
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.mjs |
Removes root reporting and coverage configuration. |
pnpm-workspace.yaml |
Registers the popover polyfill patch. |
pnpm-lock.yaml |
Locks new DOM-testing dependencies and patch. |
patches/@oddbird__popover-polyfill.patch |
Adds simulated-DOM compatibility fixes. |
packages/web/vitest.setup.ts |
Adds document and dialog test polyfills. |
packages/web/vitest.config.ts |
Defines Playwright, JSDOM, and Happy DOM projects. |
packages/web/src/tooltip/tooltip.test.ts |
Adapts tooltip tests for simulated DOMs. |
packages/web/src/toggle-group/toggle-group.browser.test.ts |
Adds browser-only keyboard tests. |
packages/web/src/readonly/readonly.test.ts |
Switches keyboard-event test utilities. |
packages/web/src/popover/popover.ts |
Changes popover method wrapping and restoration. |
packages/web/src/popover/popover.test.ts |
Tags browser-dependent popover tests. |
packages/web/src/pagination/pagination.test.ts |
Waits for mutation processing. |
packages/web/src/focusgroup/focusgroup.browser.test.ts |
Formatting-only update. |
packages/web/src/fieldset/fieldset.ts |
Reworks fieldset label discovery. |
packages/web/src/fieldset/fieldset.test.ts |
Adapts asynchronous fieldset tests. |
packages/web/src/field/field.test.ts |
Waits for mutation-driven updates. |
packages/web/src/error-summary/error-summary.test.ts |
Waits for component initialization. |
packages/web/src/clickdelegatefor/clickdelegatefor.test.ts |
Marks native-label behavior browser-only. |
packages/web/src/breadcrumbs/breadcrumbs.test.ts |
Mocks layout in simulated DOMs. |
packages/web/package.json |
Adds JSDOM, Happy DOM, and user-event. |
packages/react/package.json |
Normalizes the final newline. |
internal/react-18-tests/vitest.config.mjs |
Adds a JSON import attribute. |
.github/workflows/test.yml |
Removes coverage and JUnit report publication. |
.changeset/bumpy-taxes-sip.md |
Adds an empty changeset. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Resolves #4716