Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
teoeter wants to merge1 commit intoangular:main
base:main
Choose a base branch
Loading
fromteoeter:feat/vitest-headless-mode-support

Conversation

teoeter
Copy link

@teoeterteoeter commentedJul 9, 2025
edited
Loading

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Headless mode is currently supported only forkarma 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:

"options": {"tsConfig":"tsconfig.spec.json","buildTarget":"::development","runner":"vitest","browsers": ["ChromiumHeadless"]}

Solution 2:

Introduce a newheadless property in the schema. This approach is not compatible with Karma without a breaking API change:

"options": {"tsConfig":"tsconfig.spec.json","buildTarget":"::development","runner":"vitest","headless":true,"browsers": ["chromium"]}

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?

  • Yes
  • No

Other information

TODO: If the solution makes sense, I will write the docs and tests for it

Comment on lines +390 to +393
headless: browsers.some((name) => name.toLowerCase().includes('headless')),

instances: browsers.map((browserName) => ({
browser: browserName,
browser:normalizeBrowserName(browserName),
Copy link
Author

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

@clydin
Copy link
Member

Thank you for the contribution.
This approach appears viable. Could you update the description field of thebrowsers option in the JSON schema?

@teoeterteoeterforce-pushed thefeat/vitest-headless-mode-support branch from5fa2b38 to16c8ee2CompareJuly 17, 2025 18:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@clydinclydinclydin approved these changes

Assignees
No one assigned
Labels
area: @angular/builddetected: featurePR contains a feature commit
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@teoeter@clydin

[8]ページ先頭

©2009-2025 Movatter.jp