- Notifications
You must be signed in to change notification settings - Fork11.9k
feat(@angular/build): add headless mode for vitest browser mode#30685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
headless: browsers.some((name) => name.toLowerCase().includes('headless')), | ||
instances: browsers.map((browserName) => ({ | ||
browser: browserName, | ||
browser:normalizeBrowserName(browserName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Normalize browser names to match Vitest's expectations for headless but also supports karmas names
e.g., 'ChromeHeadless' -> 'chrome', 'FirefoxHeadless'
and 'Chrome' -> 'chrome', 'Firefox' -> 'firefox'.
and activates the vitest configuration propertyheadless: true
Thank you for the contribution. |
5fa2b38
to16c8ee2
Compare
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Headless mode is currently supported only for
karma
viabrowsers: [ 'ChromeHeadless', 'FirefoxHeadless' ]
. However, it is not supported for Vitest browser mode. SeeHeadless for more information.I considered two solutions for Vitest:
Solution 1 (Committed / Implemented):
This solution is compatible with how Karma handles headless mode, allowing for migration without configuration changes:
Solution 2:
Introduce a newheadless property in the schema. This approach is not compatible with Karma without a breaking API change:
The issue with Solution 2 is that it is not compatible with Karma, which uses
'ChromiumHeadless'
/'FirefoxHeadless'
to enable headless mode.Issue Number:#30681
What is the new behavior?
The builder can now convert the Karma headless configuration format to the Vitest format and activate headless mode accordingly.
Does this PR introduce a breaking change?
Other information
TODO: If the solution makes sense, I will write the docs and tests for it