Repository navigation
Builder Vite: Print the found Vite config path with forward slashes on Windows - #36917
Merged
Merged
Conversation
The discovery-miss warning embedded the path from empathic's find.any verbatim. On Windows that is a backslash path, so the suggested snippet `viteConfigPath: 'C:\project\vite.config.mjs'` is not a valid path once pasted into a JS string (`\v` is a vertical tab), and the nested-configDir test failed on the daily Windows unit job because it expected the posix form. Normalise the path with pathe before printing it, compute the expected string the same way in the test, and add a test that feeds a Windows path and expects forward slashes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
valentinpalkovic
approved these changes
Oct 20, 2026
kasperpeulen
marked this pull request as ready for review
October 20, 2026 17:20
kasperpeulen
enabled auto-merge
October 21, 2026 10:21
This was referenced Oct 21, 2026
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.
Since #36788 landed on
next, the daily Windows unit job fails one test invite-config.test.ts: "discovery miss reporting › warns when configDir is nested and the Vite config sits at the project root".The test mocks
find.anywithresolve('/project/vite.config.mjs'), which on Windows is a drive-letter path with backslashes, and then expects the posix string in the warning.Looking at how the warning is built showed this is not only a test problem. The path that empathic's
find.anyreturns comes fromnode:pathjoin, so on Windows it has backslashes, and the warning dropped it verbatim into a snippet meant to be pasted intomain.ts:viteConfigPath: 'C:\project\vite.config.mjs'Inside a JS string literal
\vis a vertical tab and\pis justp, so the pasted value is not the path the warning points at.The fix normalises the found path with
pathebefore printing it, so the warning readsC:/project/vite.config.mjson Windows. Vite resolvesviteConfigPathwithpath.resolve, which accepts forward slashes on Windows, so the snippet now works when pasted. The project root and config dir in the prose part of the message are left as they were.In the test, the nested-configDir case now computes the expected string the same way the code does (pathe
normalizeof theresolved mock value) and checks it in both the "found at" sentence and the snippet. A new test feeds a literal Windows path (C:\project\vite.config.mjs) intofind.anyand expects forward slashes in both places, so the Windows behaviour is covered on every platform. I checked the other tests in the describe block: they either never reach the warning or only assert that nothing was logged, and therelative(...)guard gives the same answer on Windows for their inputs, so they need no change.Files changed:
code/builders/builder-vite/src/vite-config.tscode/builders/builder-vite/src/vite-config.test.tsManual testing
From the repo root, run
yarn test code/builders/builder-vite: 15 files and 95 tests pass on macOS. With the production change reverted, the new Windows-path test fails withexpected '…' to contain 'found at "C:/project/vite.config.mjs"', so it guards the fix.yarn lint:js:cmd builders/builder-vite --quietandyarn nx check builder-viteare clean.I could not run Windows locally. The argument from the code: on Windows the mocked value is something like
D:\project\vite.config.mjs, pathe turns it intoD:/project/vite.config.mjs, and the test expects exactly that string, built with the sameresolveplusnormalize. Theci:dailylabel is on so the Windows unit job runs on this PR and confirms it.🤖 Generated with Claude Code