test(shims): expect forward-slash shim ids in the next/error and subpath resolution fixtures#2265
Merged
Conversation
…ath resolution fixtures
commit: |
Contributor
Performance benchmarksCompared 1 improved · 0 regressed · 5 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
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.
What
Wrap the expected shim paths in the "resolves next/error to the react-server shim" and "strips JavaScript extensions and Vite queries from package subpaths" tests with
normalizePathSeparators, so they compare against the forward-slash ids thatvinext:config'sresolveIdreturns on Windows.Why
vinext:config'sresolveIdhook returns Vite-style module ids — forward slashes on every platform — because it resolves shims through_shimsDir, which is normalized at module load (and the font plugins'id.startsWith(_shimsDir)guards plus the module-graphcanonicalizerequire that forward-slash form). The two fixtures built their expected values with rawpath.resolve(import.meta.dirname, …), which yields backslashes on Windows, so the assertions failed there withReceived: "E:/…/error.react-server.ts"vsExpected: "E:\…\error.react-server.ts". The source is correct; the fixtures were the only two resolveId tests in this file that did not normalize — the sibling app-rsc-handler and@vercel/ogtests already wrap their expected values innormalizePathSeparatorsfor exactly this reason. This is a fixture-only mismatch, not a production bug.How
clientShimandreactServerShimnow wrap theirpath.resolve(...)innormalizePathSeparators(...).expectedShim,expectedReactServerShim, andexpectedOgShimnow wrap theirpath.resolve(...)innormalizePathSeparators(...).// resolveId returns Vite-style ids: forward slashes on every platform.comment the sibling tests carry, so the intent is documented once per block.normalizePathSeparatorswas already imported in this file and is a no-op on POSIX, so the expected values are byte-identical there.Testing
vp test run --project unit tests/shims.test.ts -t "resolves next/error to the react-server shim only in the RSC environment"— passes.vp test run --project unit tests/shims.test.ts -t "strips JavaScript extensions and Vite queries from package subpaths"— passes.vp test run --project unit tests/shims.test.ts— failures drop from 14 to 12; the remaining 12 are the separate navigation/locale cluster, unaffected by this change.vp check tests/shims.test.ts— format, lint, and typecheck clean.Classified
testbecause only fixtures change: the source already returns the forward-slash id, and the production code path is untouched.