Skip to content

Swap jsdom for happy-dom test env (ui-extensions) - #7731

Closed
amcaplan wants to merge 3 commits into
mainfrom
remove-dep/jsdom
Closed

Swap jsdom for happy-dom test env (ui-extensions)#7731
amcaplan wants to merge 3 commits into
mainfrom
remove-dep/jsdom

Conversation

@amcaplan

@amcaplan amcaplan commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Swap jsdomhappy-dom test environment in ui-extensions packages

Why: Part of an initiative to cut low-value dependency churn (jsdom: ~2 Dependabot bumps / 24 months). happy-dom is a lighter, faster vitest browser environment with no feature gap for these packages' test suites.

What changed (devDep-only — 4 files):

  • packages/ui-extensions-dev-console/vite.config.mts — vitest environment: 'jsdom''happy-dom'
  • packages/ui-extensions-server-kit/vite.config.mts — vitest environment: 'jsdom''happy-dom'
  • both package.json — removed "jsdom": "^25.0.0", added "happy-dom": "^20.10.1" to devDependencies
  • patch changeset for @shopify/ui-extensions-server-kit (dev-console is "private": true)

Validation: All tests pass under happy-dom with no test-code changes — the swap is transparent.

Package Tests Lint
ui-extensions-dev-console 6 files / 28 tests ✅
ui-extensions-server-kit 7 files / 61 tests ✅

(server-kit type-check ✅. dev-console has pre-existing ReactNode type errors in .tsx files untouched by this change — a test-environment/devDep swap cannot affect those.)

Surface impact: devDependencies only — the published artifact of @shopify/ui-extensions-server-kit is unaffected.

🤖 AI-generated draft — needs human review before merge.

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Jun 5, 2026
@amcaplan amcaplan added dependency-removal Removes a dependency to cut Dependabot churn (cleanup initiative) claudeception Pull request created by Claudeception agents labels Jun 5, 2026
@amcaplan
amcaplan marked this pull request as ready for review June 7, 2026 14:21
@amcaplan
amcaplan requested a review from a team as a code owner June 7, 2026 14:21
Copilot AI review requested due to automatic review settings June 7, 2026 14:21
@amcaplan
amcaplan requested a review from a team as a code owner June 7, 2026 14:21

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

This PR switches the Vitest browser-like test environment for the ui-extensions packages from jsdom to happy-dom, aiming to reduce dependency churn while keeping test behavior unchanged.

Changes:

  • Update Vitest config in ui-extensions-dev-console and ui-extensions-server-kit to use environment: 'happy-dom'.
  • Replace jsdom with happy-dom in the packages’ devDependencies.
  • Update the lockfile and add a changeset for @shopify/ui-extensions-server-kit.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Updates dependency graph to reflect happy-dom adoption and removal of direct jsdom devDeps in the affected packages.
packages/ui-extensions-server-kit/vite.config.mts Switch Vitest environment from jsdom to happy-dom.
packages/ui-extensions-server-kit/package.json Replace jsdom with happy-dom in devDependencies.
packages/ui-extensions-dev-console/vite.config.mts Switch Vitest environment from jsdom to happy-dom.
packages/ui-extensions-dev-console/package.json Replace jsdom with happy-dom in devDependencies.
.changeset/swap-jsdom-happy-dom-ui-extensions.md Adds a patch changeset describing the test-environment/devDependency swap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +5
---
'@shopify/ui-extensions-server-kit': patch
---

Replace `jsdom` devDependency with `happy-dom` as the vitest test environment. This is an internal test-tooling change with no impact on the published package surface.
@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. and removed Area: @shopify/cli @shopify/cli package issues labels Jun 7, 2026

@gonzaloriestra gonzaloriestra 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.

The new dependency is 2x heavier (1.17MB vs 0.55MB) and has 7x more releases (185 vs 24 in the last 2 years).

What's the point?

amcaplan commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@gonzaloriestra you have to consider transitive dependencies.

Screenshot 2026-06-08 at 12.18.52.png

image.png

@gonzaloriestra

Copy link
Copy Markdown
Contributor

Right, but:

  • This is a dev dependency, so it won't affect the bundle size
  • Jsdom is still present in the lockfile (used by eslint-plugin-cli and vitest)
  • We are adding a new dependency

So I'm still not sure about the purpose of this 😅

What about just deduplicating jsdom instead? We have 25.0.1 and 28.1.0 now

@gonzaloriestra gonzaloriestra 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.

Ok, now that jsdom was completely removed, I guess it makes sense to switch in order to reduce the number of transitive deps 👍

@amcaplan
amcaplan force-pushed the remove-dep/jsdom branch from 7589781 to ec31b90 Compare June 8, 2026 11:52
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
→ If there's no activity within a week, then a bot will automatically close this.
Thanks for helping to improve Shopify's dev tooling and experience.

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

Labels

claudeception Pull request created by Claudeception agents dependency-removal Removes a dependency to cut Dependabot churn (cleanup initiative) no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. no-pr-activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants