Skip to content

chore: run tests with JSDOM and Happy DOM too - #5142

Merged
eirikbacker merged 27 commits into
mainfrom
fix/test-jsdom
Aug 18, 2026
Merged

chore: run tests with JSDOM and Happy DOM too#5142
eirikbacker merged 27 commits into
mainfrom
fix/test-jsdom

Conversation

@eirikbacker

Copy link
Copy Markdown
Contributor

Resolves #4716

@eirikbacker eirikbacker self-assigned this Aug 7, 2026
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c84a972

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@eirikbacker eirikbacker changed the title chore: start implementing jsdom tests chore: run tests with JSDOM and Happy DOM too Aug 7, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Preview deployments for this pull request:

storybook - 18. Aug 2026 - 10:12

@eirikbacker
eirikbacker marked this pull request as ready for review August 17, 2026 10:13
Comment on lines +3 to +4
const tick = async (_?: unknown) =>
await new Promise((resolve) => setTimeout(resolve)); // Let MutationObserver run Loop

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.

Can't we export this from somewhere? Or make it globally available in tests

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggest doing this in a separate PR. Maybe test this stack with cleaning up the test setup?

@mimarz mimarz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/react-18-tests/vitest.config.mjs Outdated
Comment thread packages/web/src/popover/popover.ts Outdated
Comment thread packages/web/src/readonly/readonly.test.ts Outdated
Comment thread vitest.config.mjs
Comment thread packages/web/vitest.setup.ts
Comment thread packages/web/vitest.setup.ts Outdated
eirikbacker and others added 5 commits August 17, 2026 14:27
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>
@Barsnes

Barsnes commented Aug 18, 2026

Copy link
Copy Markdown
Member

I am consistently getting this test failure locally 🤔
image

@eirikbacker
eirikbacker merged commit 8de670f into main Aug 18, 2026
20 checks passed
@eirikbacker
eirikbacker deleted the fix/test-jsdom branch August 18, 2026 08:21
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.

Run tests with JSDOM and HappyDOM too

4 participants