Skip to content

Commit eb36798

Browse files
committed
feat(@angular-devkit/build-angular): add --reporters option to test
It was a regression, and used by enough people on CI. No reason it should be omitted and karma.conf.js only. Fixes #11376
1 parent 8150838 commit eb36798

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

packages/angular_devkit/build_angular/src/karma/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ export class KarmaBuilder implements Builder<KarmaBuilderSchema> {
7171
karmaOptions.browsers = options.browsers.split(',');
7272
}
7373

74+
if (options.reporters) {
75+
// Split along commas to make it more natural, and remove empty strings.
76+
karmaOptions.reporters = options.reporters
77+
.reduce<string[]>((acc, curr) => acc.concat(...curr.split(/,/)), [])
78+
.filter(x => !!x);
79+
}
80+
7481
const sourceRoot = builderConfig.sourceRoot && resolve(root, builderConfig.sourceRoot);
7582

7683
karmaOptions.buildWebpack = {

packages/angular_devkit/build_angular/src/karma/schema.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ export interface KarmaBuilderSchema extends Pick<BrowserBuilderSchema,
3232
* Globs to exclude from code coverage.
3333
*/
3434
codeCoverageExclude: string[];
35+
36+
/**
37+
* Karma reporters to use. Directly passed to the karma runner.
38+
*/
39+
reporters?: string[];
3540
}

packages/angular_devkit/build_angular/src/karma/schema.json

+7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@
150150
]
151151
},
152152
"default": []
153+
},
154+
"reporters": {
155+
"type": "array",
156+
"description": "Karma reporters to use. Directly passed to the karma runner.",
157+
"items": {
158+
"type": "string"
159+
}
153160
}
154161
},
155162
"additionalProperties": false,

0 commit comments

Comments
 (0)