Skip to content

fix: keep the Vitest test config when solid-js is already external - #455

Open
RaphaelFakhri wants to merge 1 commit into
solidjs:mainfrom
RaphaelFakhri:fix/keep-test-config-with-external-solid
Open

RaphaelFakhri wants to merge 1 commit into
solidjs:mainfrom
RaphaelFakhri:fix/keep-test-config-with-external-solid

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

In test mode the plugin only returns its test config when it also sets test.server. When the user config already lists solid-js in test.server.deps.external, the plugin skips test.server and drops the whole test block with it, so Vitest gets neither the jsdom environment nor the @testing-library/jest-dom setup file. Component tests that rely on the DOM or on jest-dom matchers then fail.

This started with #183, which moved the config into a fresh test object but kept test.server as the condition for returning it.

Changes

  • Return test whenever it has any key, the same check the next branch uses.
  • Add a test:unit script, a root vitest.config.ts and src/test-config.test.ts, and run the unit tests in the Vitest workflow.
  • Add a patch changeset.

Testing

pnpm run test:unit: 2 passed. With the src/index.ts change reverted, the new external solid-js case fails (expected undefined to be 'jsdom'). pnpm run build and Prettier pass.

Fixes #454

@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0e47f1

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

This PR includes changesets to release 1 package
Name Type
vite-plugin-solid 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

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.

Vitest config is dropped when test.server.deps.external already lists solid-js

1 participant