Repository navigation
Conversation
- Vitest passes the ssr environment's conditions to Node as `--conditions` for external packages. - The plugin added `browser` to every environment in test mode, so Node resolved `browser` exports too. - `msw/node` failed because `@mswjs/interceptors/ClientRequest` exports `null` for `browser`. - DOM tests run in the client environment, and the Solid runtime is now inlined, so the ssr environment no longer gets `browser` in jsdom and happy-dom runs. - Tests with `environment: 'node'`, browser mode, `ssr: true`, or a user `external` entry for solid-js keep the old conditions. This builds on the runtime inlining from #434. Fixes #125 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 765a406 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 #125 on
main(1.x). The fix fornextis in a separate PR.This PR is based on #434 (the #369 fix) and needs it. Merge #434 first. GitHub then retargets this PR to
main.In jsdom and happy-dom tests, Node-only packages such as
msw/nodenow load. Before,setupServerfrommsw/nodefailed withPackage subpath './ClientRequest' is not defined by "exports".Cause
browsercondition to every Vite environment, includingssr.ssrenvironment's conditions to Node as--conditionsfor the packages it leaves external.browserexports for those packages.@mswjs/interceptorsexportsnullforbrowseron./ClientRequest.Changes
ssrenvironment no longer gets thebrowsercondition. Theclientenvironment keeps it.browsermakes@solidjs/testing-libraryload the server build.nodeandedge-runtimeenvironments,ssr: true, and a userexternalentry forsolid-jsare unchanged.Testing
msw3.0.3 and a jsdom test that callssetupServer. It fails without the fix on Vitest 5.0.5 and 4.1.12.examples/vite-6/tests/node-conditions.mjs, run bytest:jsdom. It fails without the fix.pnpm test:jsdompasses.browserto the client environment itself, which DOM tests need. The changeset says "Vitest 4 and later".🤖 Generated with Claude Code