Skip to content

Commit d71183f

Browse files
author
Angular Builds
committed
3663f80 refactor(@angular/build): extract headless configuration logic into helper function
1 parent 4a53ba8 commit d71183f

6 files changed

Lines changed: 84 additions & 34 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular/build",
3-
"version": "22.0.0-next.3+sha-8dd341e",
3+
"version": "22.0.0-next.3+sha-3663f80",
44
"description": "Official build system for Angular",
55
"keywords": [
66
"Angular CLI",
@@ -23,7 +23,7 @@
2323
"builders": "builders.json",
2424
"dependencies": {
2525
"@ampproject/remapping": "2.3.0",
26-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#8dd341e",
26+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#3663f80",
2727
"@babel/core": "7.29.0",
2828
"@babel/helper-annotate-as-pure": "7.27.3",
2929
"@babel/helper-split-export-declaration": "7.24.7",
@@ -60,7 +60,7 @@
6060
"@angular/platform-browser": "^22.0.0-next.0",
6161
"@angular/platform-server": "^22.0.0-next.0",
6262
"@angular/service-worker": "^22.0.0-next.0",
63-
"@angular/ssr": "github:angular/angular-ssr-builds#8dd341e",
63+
"@angular/ssr": "github:angular/angular-ssr-builds#3663f80",
6464
"karma": "^6.4.0",
6565
"less": "^4.2.0",
6666
"ng-packagr": "^22.0.0-next.0",

src/builders/unit-test/runners/vitest/browser-provider.d.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.dev/license
77
*/
8-
import type { BrowserConfigOptions } from 'vitest/node';
8+
import type { BrowserBuiltinProvider, BrowserConfigOptions, BrowserProviderOption } from 'vitest/node';
99
export interface BrowserConfiguration {
1010
browser?: BrowserConfigOptions;
1111
errors?: string[];
@@ -14,8 +14,31 @@ export interface BrowserConfiguration {
1414
export interface BrowserInstanceConfiguration {
1515
browser: string;
1616
headless: boolean;
17-
provider?: import('vitest/node').BrowserProviderOption;
17+
provider?: BrowserProviderOption;
1818
}
19+
/**
20+
* Mutates the provided browser instances to apply standard headless execution
21+
* constraints based on the chosen provider, user options, and CI environment presence.
22+
*
23+
* @param instances The normalized browser instances to mutate.
24+
* @param providerName The identifier for the chosen Vitest browser provider.
25+
* @param headless The user-provided headless configuration option.
26+
* @param isCI Whether the current environment is running in CI.
27+
* @returns An array of informational messages generated during evaluation.
28+
*/
29+
export declare function applyHeadlessConfiguration(instances: BrowserInstanceConfiguration[], providerName: BrowserBuiltinProvider | undefined, headless: boolean | undefined, isCI: boolean): string[];
30+
/**
31+
* Resolves and configures the Vitest browser provider for the unit test builder.
32+
* Dynamically discovers and imports the necessary provider (Playwright, WebdriverIO, or Preview),
33+
* maps the requested browser instances, and applies environment-specific execution logic.
34+
*
35+
* @param browsers An array of requested browser names (e.g., 'chrome', 'firefox').
36+
* @param headless User-provided configuration for headless execution.
37+
* @param debug Whether the builder is running in watch or debug mode.
38+
* @param projectSourceRoot The root directory of the project being tested for resolving installed packages.
39+
* @param viewport Optional viewport dimensions to apply to the launched browser instances.
40+
* @returns A fully resolved Vitest browser configuration object alongside any generated warning or error messages.
41+
*/
1942
export declare function setupBrowserConfiguration(browsers: string[] | undefined, headless: boolean | undefined, debug: boolean, projectSourceRoot: string, viewport: {
2043
width: number;
2144
height: number;

src/builders/unit-test/runners/vitest/browser-provider.js

Lines changed: 53 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/builders/unit-test/runners/vitest/browser-provider.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/normalize-cache.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Mon Mar 30 2026 19:12:38 GMT+0000 (Coordinated Universal Time)
1+
Tue Mar 31 2026 07:18:10 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)