From 94baea8ec498cf6b499a3382c5342d0938b6eb32 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Thu, 11 Dec 2025 17:36:56 -0500 Subject: [PATCH] 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. --- packages/angular/build/src/builders/unit-test/options.ts | 2 +- .../build/src/builders/unit-test/runners/vitest/executor.ts | 2 +- packages/angular/build/src/builders/unit-test/schema.json | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/angular/build/src/builders/unit-test/options.ts b/packages/angular/build/src/builders/unit-test/options.ts index 8fa5b14eda59..7f8f8db182fe 100644 --- a/packages/angular/build/src/builders/unit-test/options.ts +++ b/packages/angular/build/src/builders/unit-test/options.ts @@ -119,7 +119,7 @@ export async function normalizeOptions( browserViewport: width && height ? { width, height } : undefined, watch, debug: options.debug ?? false, - ui: options.ui ?? false, + ui: process.env['CI'] ? false : ui, providersFile: options.providersFile && path.join(workspaceRoot, options.providersFile), setupFiles: options.setupFiles ? options.setupFiles.map((setupFile) => path.join(workspaceRoot, setupFile)) diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts index bac8e389c4c5..244e5f6719b6 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts @@ -220,7 +220,7 @@ export class VitestExecutor implements TestExecutor { cache: cacheOptions.enabled ? undefined : false, testNamePattern: this.options.filter, watch, - ui, + ...(typeof ui === 'boolean' ? { ui } : {}), ...debugOptions, }, { diff --git a/packages/angular/build/src/builders/unit-test/schema.json b/packages/angular/build/src/builders/unit-test/schema.json index 3b92d31a4cde..2a3cf27719e8 100644 --- a/packages/angular/build/src/builders/unit-test/schema.json +++ b/packages/angular/build/src/builders/unit-test/schema.json @@ -67,8 +67,7 @@ }, "ui": { "type": "boolean", - "description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner.", - "default": false + "description": "Enables the Vitest UI for interactive test execution. This option is only available for the Vitest runner." }, "coverage": { "type": "boolean",