Skip to content

Commit

Permalink
feat(@angular-devkit/build-angular): add support for --no-browsers
Browse files Browse the repository at this point in the history
…in karma builder

This commit enables users to disable runnings tests against a browsers. This can be done by using the `--no-browsers` command line flag or setting `browsers` to `false` in the `angular.json`

Closes #26537
  • Loading branch information
alan-agius4 committed Dec 7, 2023
1 parent 78d1720 commit 204794c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion goldens/public-api/angular_devkit/build_angular/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export interface FileReplacement {
// @public
export interface KarmaBuilderOptions {
assets?: AssetPattern_3[];
browsers?: string;
browsers?: Browsers;
codeCoverage?: boolean;
codeCoverageExclude?: string[];
exclude?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 204794c

Please sign in to comment.