Skip to content

fix(vitest): stop defaulting test.environment to jsdom - #459

Open
ryansolid wants to merge 1 commit into
fix/125-msw-node-conditionsfrom
claude/project-thread-5q01in-jsdom
Open

ryansolid wants to merge 1 commit into
fix/125-msw-node-conditionsfrom
claude/project-thread-5q01in-jsdom

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

This PR is stacked on #437, which is stacked on #433. Merge those first. GitHub then retargets this PR to next.

Problem

In test mode, the plugin set test.environment: 'jsdom' whenever the config left the environment unset, except in browser mode or a projects root. OpenClaw's Solid 2 migration added the plugin to a shared config that their Node-only Vitest suites also load, because those tests import UI renderers. About 25 database-worker shards then ran under jsdom and failed with errors that were hard to trace ("The URL must be of scheme file", corrupt worker frames). Other framework plugins leave Vitest's node default alone.

Change

  • The plugin no longer injects test.environment. Projects set jsdom or happy-dom for DOM component tests themselves.
  • Posture is unchanged. An unset environment keeps the client posture (browser conditions, DOM codegen), and node or edge-runtime still selects the server posture.
  • README: the Testing section says to set the environment.
  • examples/start-ssr: the non-projects config sets environment: 'jsdom' explicitly. The browser-env check now asserts that no environment is injected in either case. It resolves without the config file, so it would fail on the old default.
  • Patch changeset.

Testing

  • node test/run.mjs vitest in examples/start-ssr: 8/8 pass.
  • pnpm test:unit: 21 passed.
  • tsc --noEmit is clean. Prettier warnings on src/index.ts, README.md and run.mjs are the same as on the base branch.

Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016PFhdmTPKsQSS3fENqTi5b
@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 711c918

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

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

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

@ryansolid ryansolid self-assigned this Oct 21, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@459

commit: 711c918

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