Skip to content

Commit 9f59b77

Browse files
committed
refactor(@angular/build): make runner optional in unit-test builder
The `runner` option in the `unit-test` builder is now optional to streamline the user configuration. If the `runner` option is not provided, the builder now defaults to using the `vitest` value. The builder's schema has been updated to reflect this change by removing `runner` from the required properties and updating its entry to document the new default behavior.
1 parent bf468e1 commit 9f59b77

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

goldens/public-api/angular/build/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export type UnitTestBuilderOptions = {
235235
progress?: boolean;
236236
providersFile?: string;
237237
reporters?: SchemaReporter[];
238-
runner: Runner;
238+
runner?: Runner;
239239
setupFiles?: string[];
240240
tsConfig?: string;
241241
watch?: boolean;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export async function normalizeOptions(
8282
include: options.include ?? ['**/*.spec.ts'],
8383
exclude: options.exclude,
8484
filter,
85-
runnerName: runner,
85+
runnerName: runner ?? 'vitest',
8686
coverage: options.coverage
8787
? {
8888
all: options.coverageAll,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"runner": {
1717
"type": "string",
1818
"description": "Specifies the test runner to use for test execution.",
19+
"default": "vitest",
1920
"enum": ["karma", "vitest"]
2021
},
2122
"browsers": {
@@ -267,5 +268,5 @@
267268
}
268269
},
269270
"additionalProperties": false,
270-
"required": ["runner"]
271+
"required": []
271272
}

tests/legacy-cli/e2e/utils/vitest.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ export async function applyVitestBuilder(): Promise<void> {
1919
// Update to Vitest builder.
2020
const test = project['architect']['test'];
2121
test['builder'] = '@angular/build:unit-test';
22-
test['options'] = {
23-
tsConfig: test['options']['tsConfig'],
24-
buildTarget: '::development',
25-
runner: 'vitest',
26-
};
22+
test['options'] = {};
2723
});
2824

2925
await updateJsonFile('tsconfig.spec.json', (tsconfig) => {

0 commit comments

Comments
 (0)