Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 9, 2025

This change improves how user-defined Vitest configurations work with the Angular CLI's unit test builder.

The builder now checks for and handles specific options in vitest-base.config.ts. It detects the test.projects option, logs a warning, and removes it to prevent conflicts. The test.include option is handled in a similar way, ensuring the builder's test discovery is used. Any test.setupFiles from vitest-base.config.ts are now added to the CLI's setup files, supporting both single string and array formats. User-defined Vite plugins from vitest-base.config.ts are also combined with the builder's plugins, with a filter to prevent duplicating internal CLI plugins.

These updates give users more flexibility to customize their Vitest setup while keeping the Angular CLI's test builder predictable.

This change improves how user-defined Vitest configurations work with the Angular CLI's unit test builder.

The builder now checks for and handles specific options in `vitest-base.config.ts`. It detects the `test.projects` option, logs a warning, and removes it to prevent conflicts. The `test.include` option is handled in a similar way, ensuring the builder's test discovery is used. Any `test.setupFiles` from `vitest-base.config.ts` are now added to the CLI's setup files, supporting both single string and array formats. User-defined Vite plugins from `vitest-base.config.ts` are also combined with the builder's plugins, with a filter to prevent duplicating internal CLI plugins.

These updates give users more flexibility to customize their Vitest setup while keeping the Angular CLI's test builder predictable.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 9, 2025
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 9, 2025
@clydin clydin requested a review from alan-agius4 November 9, 2025 05:49
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 9, 2025
@clydin clydin merged commit 0aab115 into angular:main Nov 9, 2025
35 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 9, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the unit-test/vitest-config-merging branch November 9, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants