Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Sep 30, 2025

Introduces a new option, browserViewport, to the unit-test builder to allow configuring the browser's viewport size during test execution.

This option accepts a string in the format widthxheight (e.g., 1280x720) and is passed to the underlying browser provider when using the Vitest runner. This is particularly useful for testing responsive layouts or ensuring components render consistently at a specific size.

A warning has been added to the Karma runner to inform users that this option is not supported, preventing confusion and providing clear feedback.

Closes #31321

@clydin clydin added the target: major This PR is targeted for the next major release label Sep 30, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/build labels Sep 30, 2025
@clydin clydin force-pushed the vitest/browser-viewport branch from 6943130 to 8f5a202 Compare September 30, 2025 20:50
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 1, 2025
@clydin clydin requested a review from alan-agius4 October 1, 2025 13:01
@clydin clydin force-pushed the vitest/browser-viewport branch from 8f5a202 to 06031e7 Compare October 2, 2025 11:59
… tests

Introduces a new option, `browserViewport`, to the unit-test builder to allow configuring the browser's viewport size during test execution.

This option accepts a string in the format `widthxheight` (e.g., `1280x720`) and is passed to the underlying browser provider when using the Vitest runner. This is particularly useful for testing responsive layouts or ensuring components render consistently at a specific size.

A warning has been added to the Karma runner to inform users that this option is not supported, preventing confusion and providing clear feedback.
@clydin clydin force-pushed the vitest/browser-viewport branch from 06031e7 to faa04e2 Compare October 2, 2025 21:34
@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 Oct 3, 2025
@clydin clydin merged commit 3e0209d into angular:main Oct 3, 2025
56 of 57 checks passed
@clydin clydin deleted the vitest/browser-viewport branch October 3, 2025 09:20
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 detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Vitest]: Add viewport configuration to angular.json

2 participants