Skip to content

Commit 3fd6afc

Browse files
hanslalexeagle
authored andcommitted
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 52b22bf commit 3fd6afc

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

packages/angular/cli/lib/config/schema.json

+7
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,13 @@
12611261
]
12621262
},
12631263
"default": []
1264+
},
1265+
"reporters": {
1266+
"type": "array",
1267+
"description": "Karma reporters to use. Directly passed to the karma runner.",
1268+
"items": {
1269+
"type": "string"
1270+
}
12641271
}
12651272
},
12661273
"additionalProperties": false,

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)