Skip to content

Commit 4dd3c1a

Browse files
clydinhybrist
authored andcommitted
fix(@angular/build): conditionally manage Vitest UI option
This change improves the handling of the Vitest UI option in the unit test builder. The `ui` option is now automatically disabled when running in a CI environment to prevent issues with automated pipelines. Additionally, the `ui` property is only included in the Vitest configuration if it's explicitly a boolean, making the option handling more robust. Removing the default value for `ui` from the schema allows the option to be overridden by custom runner configuration files when not explicitly defined in `angular.json` or via the command line. (cherry picked from commit 7c7e6a6)
1 parent 6f4b955 commit 4dd3c1a

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

packages/angular/build/src/builders/unit-test/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export async function normalizeOptions(
119119
browserViewport: width && height ? { width, height } : undefined,
120120
watch,
121121
debug: options.debug ?? false,
122-
ui: options.ui ?? false,
122+
ui: process.env['CI'] ? false : ui,
123123
providersFile: options.providersFile && path.join(workspaceRoot, options.providersFile),
124124
setupFiles: options.setupFiles
125125
? options.setupFiles.map((setupFile) => path.join(workspaceRoot, setupFile))

packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class VitestExecutor implements TestExecutor {
220220
cache: cacheOptions.enabled ? undefined : false,
221221
testNamePattern: this.options.filter,
222222
watch,
223-
ui,
223+
...(typeof ui === 'boolean' ? { ui } : {}),
224224
...debugOptions,
225225
},
226226
{

packages/angular/build/src/builders/unit-test/schema.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@
6767
},
6868
"ui": {
6969
"type": "boolean",
70-
"description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner.",
71-
"default": false
70+
"description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner."
7271
},
7372
"coverage": {
7473
"type": "boolean",

0 commit comments

Comments
 (0)