Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 28, 2025

When using the Vitest runner, a standard vitest.config.js file can cause conflicts with other tools or IDE extensions that might assume it represents a complete, standalone configuration. However, the builder uses this file only as a base configuration, which is then merged with its own internal setup.

To avoid this ambiguity, the builder now searches for a vitest-base.config.(js|ts|...etc) file when the runnerConfig option is set to true. This makes the intent clear that the file provides a base configuration specifically for the Angular CLI builder.

The search order is as follows:

  1. Project Root
  2. Workspace Root

If no vitest-base.config.* file is found, the builder proceeds with its default in-memory configuration. Vitest's default behavior of searching for vitest.config.* is explicitly disabled in this mode to ensure predictable and consistent test execution.

When using the Vitest runner, a standard `vitest.config.js` file can cause conflicts with other tools or IDE extensions that might assume it represents a complete, standalone configuration. However, the builder uses this file only as a *base* configuration, which is then merged with its own internal setup.

To avoid this ambiguity, the builder now searches for a `vitest-base.config.(js|ts|...etc)` file when the `runnerConfig` option is set to `true`. This makes the intent clear that the file provides a base configuration specifically for the Angular CLI builder.

The search order is as follows:
1. Project Root
2. Workspace Root

If no `vitest-base.config.*` file is found, the builder proceeds with its default in-memory configuration. Vitest's default behavior of searching for `vitest.config.*` is explicitly disabled in this mode to ensure predictable and consistent test execution.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Oct 28, 2025
@yjaaidi
Copy link
Contributor

yjaaidi commented Oct 28, 2025

🙏 thank you Charles!

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 28, 2025
@clydin clydin requested a review from alan-agius4 October 28, 2025 23:36
@clydin clydin 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 Oct 29, 2025
@clydin clydin merged commit 0fe6db9 into angular:main Oct 29, 2025
35 checks passed
@clydin
Copy link
Member Author

clydin commented Oct 29, 2025

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

@clydin clydin deleted the unit-test/default-runner-config-vitest branch October 29, 2025 17:29
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.

3 participants