Repository navigation
fix(vitest): inline the Solid runtime and its consumers in client tests - #433
Merged
Merged
Conversation
… test posture The client posture kept solid-js external, so packages without a `solid` export condition (such as @solidjs/testing-library) were imported natively and their own imports were resolved by the host runtime. Node gets the `browser` condition from vitest's worker --conditions, but Deno resolves `deno`/`node`, so @solidjs/testing-library loaded the server build of @solidjs/web and `render` failed with isServer true. - Inline solid-js, @solidjs/web and the runtime consumers found by the vitefu crawl through test.server.deps.inline in the client posture. - Merge with a user inline list; skip for `inline: true` or a user external entry for solid-js. - Add a start-ssr vitest check that emulates Deno's resolution with a Node resolve hook and renders through @solidjs/testing-library. Refs #369 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 5c5fd6f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #369 on
next. The 1.x fix formainis in a separate PR.In jsdom tests, packages that import
@solidjs/web, such as@solidjs/testing-library, now get the browser build under Deno. Before,renderthrewClient-only API called on the server side.Cause
solid-jsexternal, along with the packages that use it.browsercondition to worker threads (pool: 'threads'). Those threads resolved@solidjs/webto the server build.Changes
solid-js,@solidjs/web, and every package that lists either one as a dependency or peer. They resolve through Vite'sbrowsercondition.server.deps.inlinelist is merged with the plugin's.inline: trueand a userexternalentry forsolid-jsare left alone.Known limit
Testing
examples/start-ssr/src/testing-library.test.tsx. It renders a counter through@solidjs/testing-libraryand clicks it.runtime-consumerscheck tonode test/run.mjs vitest. It runs the test with a resolve hook that removesbrowserand addsdeno, the same as Deno.--pool=forksand--pool=threads.Client-only API called on the server side.pnpm test:unitandtsc --noEmitpass.node test/run.mjs vitestpasses 7/7.🤖 Generated with Claude Code