Skip to content

Commit

Permalink
feat(@angular-devkit/build-angular): add --reporters option to test
Browse files Browse the repository at this point in the history
It was a regression, and used by enough people on CI. No reason it should be
omitted and karma.conf.js only.

Fixes #11376
  • Loading branch information
hansl authored and alexeagle committed Oct 1, 2018
1 parent 52b22bf commit 3fd6afc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/angular/cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,13 @@
]
},
"default": []
},
"reporters": {
"type": "array",
"description": "Karma reporters to use. Directly passed to the karma runner.",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
Expand Down
7 changes: 7 additions & 0 deletions packages/angular_devkit/build_angular/src/karma/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ export class KarmaBuilder implements Builder<KarmaBuilderSchema> {
karmaOptions.browsers = options.browsers.split(',');
}

if (options.reporters) {
// Split along commas to make it more natural, and remove empty strings.
karmaOptions.reporters = options.reporters
.reduce<string[]>((acc, curr) => acc.concat(curr.split(/,/)), [])
.filter(x => !!x);
}

const sourceRoot = builderConfig.sourceRoot && resolve(root, builderConfig.sourceRoot);

karmaOptions.buildWebpack = {
Expand Down
5 changes: 5 additions & 0 deletions packages/angular_devkit/build_angular/src/karma/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ export interface KarmaBuilderSchema extends Pick<BrowserBuilderSchema,
* Globs to exclude from code coverage.
*/
codeCoverageExclude: string[];

/**
* Karma reporters to use. Directly passed to the karma runner.
*/
reporters?: string[];
}
7 changes: 7 additions & 0 deletions packages/angular_devkit/build_angular/src/karma/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@
]
},
"default": []
},
"reporters": {
"type": "array",
"description": "Karma reporters to use. Directly passed to the karma runner.",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
Expand Down

0 comments on commit 3fd6afc

Please sign in to comment.