diff --git a/goldens/public-api/angular_devkit/build_angular/index.md b/goldens/public-api/angular_devkit/build_angular/index.md index 4230b8f95a1f..982a45d9c786 100644 --- a/goldens/public-api/angular_devkit/build_angular/index.md +++ b/goldens/public-api/angular_devkit/build_angular/index.md @@ -271,7 +271,7 @@ export interface FileReplacement { // @public export interface KarmaBuilderOptions { assets?: AssetPattern_3[]; - browsers?: string; + browsers?: Browsers; codeCoverage?: boolean; codeCoverageExclude?: string[]; exclude?: string[]; diff --git a/packages/angular_devkit/build_angular/src/builders/karma/index.ts b/packages/angular_devkit/build_angular/src/builders/karma/index.ts index 7c96f9fe91e4..d9d0ef8b6ff7 100644 --- a/packages/angular_devkit/build_angular/src/builders/karma/index.ts +++ b/packages/angular_devkit/build_angular/src/builders/karma/index.ts @@ -100,8 +100,10 @@ export function execute( karmaOptions.singleRun = singleRun; // Convert browsers from a string to an array - if (options.browsers) { + if (typeof options.browsers === 'string' && options.browsers) { karmaOptions.browsers = options.browsers.split(','); + } else if (options.browsers === false) { + karmaOptions.browsers = []; } if (options.reporters) { diff --git a/packages/angular_devkit/build_angular/src/builders/karma/schema.json b/packages/angular_devkit/build_angular/src/builders/karma/schema.json index 7f9a5e699b8d..9e8500d2227a 100644 --- a/packages/angular_devkit/build_angular/src/builders/karma/schema.json +++ b/packages/angular_devkit/build_angular/src/builders/karma/schema.json @@ -199,8 +199,18 @@ "description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set." }, "browsers": { - "type": "string", - "description": "Override which browsers tests are run against." + "description": "Override which browsers tests are run against. Set to `false` to not use any browser.", + "oneOf": [ + { + "type": "string", + "description": "A comma seperate list of browsers to run tests against." + }, + { + "const": false, + "type": "boolean", + "description": "Does use run tests against a browser." + } + ] }, "codeCoverage": { "type": "boolean",