Skip to content

fix(@angular/build): normalize setupFiles paths to POSIX for vitest runner - #33831

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/vitest-windows-setup-files
Open

fix(@angular/build): normalize setupFiles paths to POSIX for vitest runner#33831
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/vitest-windows-setup-files

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

On Windows, absolute paths generated by joining the workspace root and the configured setup files contain backslashes. This causes a mismatch during test execution when the Vitest in-memory loading plugin resolves paths in POSIX format (with forward slashes) and attempts to look them up in the entry point mapping, leading to failed import resolutions.

Normalizing setupFiles paths to POSIX at the options normalization stage ensures consistency across the entire build and execution pipeline, resolving the import resolution errors on Windows.

Closes #33749

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the unit-test builder options to convert setup file paths to POSIX format using toPosixPath. Additionally, it simplifies boolean checks in the SSR response utility by removing redundant Boolean() wrappers. There are no review comments, and we have no feedback to provide.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 11, 2026
@alan-agius4
alan-agius4 force-pushed the fix/vitest-windows-setup-files branch from 0db3d21 to 11fb576 Compare August 11, 2026 08:30
@alan-agius4
alan-agius4 requested a review from clydin August 11, 2026 08:30
…unner

On Windows, absolute paths generated by joining the workspace root and the configured setup files contain backslashes. This causes a mismatch during test execution when the Vitest in-memory loading plugin resolves paths in POSIX format (with forward slashes) and attempts to look them up in the entry point mapping, leading to failed import resolutions.

Normalizing `setupFiles` paths to POSIX at the options normalization stage ensures consistency across the entire build and execution pipeline, resolving the import resolution errors on Windows.

Closes angular#33749
@alan-agius4
alan-agius4 force-pushed the fix/vitest-windows-setup-files branch from 11fb576 to 93e1f5b Compare August 11, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build area: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@angular/build: ng test fails on Windows — setupFiles path not normalized to POSIX, breaks import resolution

1 participant