Repository navigation
Conversation
…oot is aliased When `vitestConfig.root` differs from `workspaceRoot` (such as with symlinks or Windows `subst` drives), `VitestExecutor` still invalidated and queried test specifications during incremental watch-mode rebuilds using the un-rebased `workspaceRoot` paths. Because Vitest keys its module graph and test specifications against `vitest.config.root`, incremental re-runs could fail to invalidate cached modules or locate the affected test specifications. To address this, extract a `rebasePath` helper in `plugins.ts` that converts paths between roots while leaving paths that cannot be expressed relative to the original root (such as files on a different Windows drive) unchanged instead of concatenating them. `VitestExecutor` now uses this helper during incremental rebuilds to rebase modified output and source file paths onto `vitest.config.root` when the root is aliased. Additionally, `configureVitest` now rebases from the original plugin options rather than mutating from the previous root so repeated invocations remain idempotent. `plugins_spec.ts` is expanded to cover `rebasePath`, `angular:` virtual entries, absolute setup files under coverage, and repeated `configureVitest` calls, and a new `executor_spec.ts` covers the incremental rebuild paths.
clydin
force-pushed
the
fix/vitest-aliased-root-followups
branch
from
November 13, 2026 21:34
e7c8b46 to
4d3926d
Compare
clydin
marked this pull request as ready for review
November 13, 2026 21:42
There was a problem hiding this comment.
Code Review
This pull request introduces path rebasing support for the Vitest unit test runner when the Vitest root is aliased (different from the workspace root). It adds a rebasePath utility to correctly map file paths between the workspace root and the Vitest root, ensuring that incremental rebuilds, file invalidations, and setup file loading work correctly in aliased environments. Unit tests have been added to verify these changes. There are no review comments, so I have no feedback to provide.
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.
When
vitestConfig.rootdiffers fromworkspaceRoot(such as with symlinks or Windowssubstdrives),VitestExecutorstill invalidated and queried test specifications during incremental watch-mode rebuilds using the un-rebasedworkspaceRootpaths. Because Vitest keys its module graph and test specifications againstvitest.config.root, incremental re-runs could fail to invalidate cached modules or locate the affected test specifications.To address this, extract a
rebasePathhelper inplugins.tsthat converts paths between roots while leaving paths that cannot be expressed relative to the original root (such as files on a different Windows drive) unchanged instead of concatenating them.VitestExecutornow uses this helper during incremental rebuilds to rebase modified output and source file paths ontovitest.config.rootwhen the root is aliased. Additionally,configureVitestnow rebases from the original plugin options rather than mutating from the previous root so repeated invocations remain idempotent.plugins_spec.tsis expanded to coverrebasePath,angular:virtual entries, absolute setup files under coverage, and repeatedconfigureVitestcalls, and a newexecutor_spec.tscovers the incremental rebuild paths.