Skip to content

Commit a415a49

Browse files
committed
fix(@angular/build): improve default coverage reporter handling for vitest
When using the experimental `unit-test` builder with the `vitest` runner, the default handling for the coverage reporter option has been improved to avoid a potential upstream failure within Vitest. Vitest can crash if an explicit `undefined` value is present for the `coverage.reporter` option.
1 parent cbc18b5 commit a415a49

File tree

1 file changed

+4
-1
lines changed
  • packages/angular/build/src/builders/unit-test

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,12 @@ export async function* execute(
232232
watch: normalizedOptions.watch,
233233
coverage: {
234234
enabled: !!normalizedOptions.codeCoverage,
235-
reporter: normalizedOptions.codeCoverage?.reporters,
236235
excludeAfterRemap: true,
237236
exclude: normalizedOptions.codeCoverage?.exclude,
237+
// Special handling for `reporter` due to an undefined value causing upstream failures
238+
...(normalizedOptions.codeCoverage?.reporters
239+
? { reporters: normalizedOptions.codeCoverage.reporters }
240+
: {}),
238241
},
239242
...debugOptions,
240243
},

0 commit comments

Comments
 (0)