Skip to content

fix(@angular/build): add webcontainer support for Vitest browser provider#31711

Merged
clydin merged 1 commit intoangular:mainfrom
clydin:unit-test/vitest-browser-preview
Nov 5, 2025
Merged

fix(@angular/build): add webcontainer support for Vitest browser provider#31711
clydin merged 1 commit intoangular:mainfrom
clydin:unit-test/vitest-browser-preview

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 5, 2025

Currently, Vitest's browser providers (playwright, webdriverio) are not compatible with webcontainer environments. This change introduces detection for webcontainers and and automatically configures the Vitest unit test builder to use the @vitest/browser-preview provider when running within a webcontainer.

This ensures that browser-based unit tests can execute correctly in webcontainer environments, providing a more consistent development experience across different platforms. The user is notified when the webcontainer environment is detected and the preview provider is activated. Dependency checks are also updated to ensure the correct @vitest/browser-preview package is installed when needed.

NOTE: For advanced scenarios, a custom runner config can be used to customize the browser configuration instead of using the builtin --browsers option and its automatic configuration.

…ider

Currently, Vitest's browser providers (playwright, webdriverio) are not compatible with webcontainer environments. This change introduces detection for webcontainers and and automatically configures the Vitest unit test builder to use the `@vitest/browser-preview` provider when running within a webcontainer.

This ensures that browser-based unit tests can execute correctly in webcontainer environments, providing a more consistent development experience across different platforms. The user is notified when the webcontainer environment is detected and the preview provider is activated. Dependency checks are also updated to ensure the correct `@vitest/browser-preview` package is installed when needed.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 5, 2025
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Nov 5, 2025
@clydin clydin merged commit 50072cd into angular:main Nov 5, 2025
34 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 5, 2025

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

@clydin clydin deleted the unit-test/vitest-browser-preview branch November 5, 2025 22:29
@yjaaidi
Copy link
Contributor

yjaaidi commented Nov 6, 2025

❤️
Thank you for this as it closes #31654

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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