@@ -338,7 +338,7 @@ async function getProjectSourceRoot(context: BuilderContext): Promise<string> {
338338}
339339
340340function normalizePolyfills (
341- polyfills : string [ ] | undefined = [ ] ,
341+ polyfills : string [ ] = [ ] ,
342342) : [ polyfills : string [ ] , jasmineCleanup : string [ ] ] {
343343 const jasmineGlobalEntryPoint = localResolve ( './polyfills/jasmine_global.js' ) ;
344344 const jasmineGlobalCleanupEntrypoint = localResolve ( './polyfills/jasmine_global_cleanup.js' ) ;
@@ -711,8 +711,6 @@ function getBaseKarmaOptions(
711711 options : NormalizedKarmaBuilderOptions ,
712712 context : BuilderContext ,
713713) : ConfigOptions {
714- const singleRun = ! options . watch ;
715-
716714 // Determine project name from builder context target
717715 const projectName = context . target ?. project ;
718716 if ( ! projectName ) {
@@ -723,13 +721,14 @@ function getBaseKarmaOptions(
723721 ? { }
724722 : getBuiltInKarmaConfig ( context . workspaceRoot , projectName ) ;
725723
724+ const singleRun = ! options . watch ;
726725 karmaOptions . singleRun = singleRun ;
727726
728727 // Workaround https://github.com/angular/angular-cli/issues/28271, by clearing context by default
729728 // for single run executions. Not clearing context for multi-run (watched) builds allows the
730729 // Jasmine Spec Runner to be visible in the browser after test execution.
731730 karmaOptions . client ??= { } ;
732- karmaOptions . client . clearContext ??= singleRun ?? false ; // `singleRun` defaults to `false` per Karma docs.
731+ karmaOptions . client . clearContext ??= singleRun ;
733732
734733 // Convert browsers from a string to an array
735734 if ( options . browsers ) {
0 commit comments