Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
fix(@angular-devkit/build-angular): allow optional karma watch
Browse files Browse the repository at this point in the history
Fixes #847
  • Loading branch information
clydin authored and hansl committed May 9, 2018
1 parent 51c6129 commit 5426382
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ const init: any = (config: any, emitter: any, customFileHandlers: any) => {
delete webpackConfig.entry.styles;

// The webpack tier owns the watch behavior so we want to force it in the config.
webpackConfig.watch = options.watch;
if (!options.watch) {
webpackConfig.watch = !config.singleRun;
if (config.singleRun) {
// There's no option to turn off file watching in webpack-dev-server, but
// we can override the file watcher instead.
webpackConfig.plugins.unshift({
Expand Down
8 changes: 5 additions & 3 deletions packages/angular_devkit/build_angular/src/karma/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ export class KarmaBuilder implements Builder<KarmaBuilderSchema> {
// TODO: adjust options to account for not passing them blindly to karma.
// const karmaOptions: any = Object.assign({}, options);
// tslint:disable-next-line:no-any
const karmaOptions: any = {
singleRun: !options.watch,
};
const karmaOptions: any = {};

if (options.watch !== undefined) {
karmaOptions.singleRun = !options.watch;
}

// Convert browsers from a string to an array
if (options.browsers) {
Expand Down
3 changes: 1 addition & 2 deletions packages/angular_devkit/build_angular/src/karma/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
},
"watch": {
"type": "boolean",
"description": "Run build when files change.",
"default": false
"description": "Run build when files change."
},
"poll": {
"type": "number",
Expand Down

0 comments on commit 5426382

Please sign in to comment.