Skip to content

Commit 476f94f

Browse files
committed
fix(@angular-devkit/build-angular): fix --watch regression in karma
Outside of single-run mode, the karma test provider was expected to watch for changes. In the application builder branch, we only handled the case of an explicit `--watch` though. This meant that the karma runner was kept running but didn't see any file changes. Fixes #28730 (cherry picked from commit 8646751)
1 parent f8677f6 commit 476f94f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/angular_devkit/build_angular/src/builders/karma/application_builder.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export function execute(
123123
switchMap(
124124
([karma, karmaConfig, buildOptions]) =>
125125
new Observable<BuilderOutput>((subscriber) => {
126-
if (options.watch) {
126+
// If `--watch` is explicitly enabled or if we are keeping the Karma
127+
// process running, we should hook Karma into the build.
128+
if (options.watch ?? !karmaConfig.singleRun) {
127129
injectKarmaReporter(context, buildOptions, karmaConfig, subscriber);
128130
}
129131

0 commit comments

Comments
 (0)