diff --git a/addon/ng2/commands/test.js b/addon/ng2/commands/test.js index 23b6940898bc..9560e4897d9f 100644 --- a/addon/ng2/commands/test.js +++ b/addon/ng2/commands/test.js @@ -13,13 +13,13 @@ var win = require('ember-cli/lib/utilities/windows-admin'); var path = require('path'); var BuildTask = require('ember-cli/lib/tasks/build'); -var BuildWatchTask = require('../tasks/build-watch'); +var BuildWatchTask = require('ember-cli/lib/tasks/build-watch'); var TestTask = require('../tasks/test'); module.exports = TestCommand.extend({ availableOptions: [ - { name: 'watch', type: Boolean, default: false, aliases: ['w'] }, + { name: 'watch', type: Boolean, default: true, aliases: ['w'] }, { name: 'browsers', type: String }, { name: 'colors', type: Boolean }, { name: 'log-level', type: String }, @@ -43,25 +43,23 @@ module.exports = TestCommand.extend({ analytics: this.analytics, project: this.project }); - commandOptions.singleRun = true; var buildOptions = { environment: 'development', outputPath: 'dist/' }; - + if (commandOptions.watch){ return win.checkWindowsElevation(this.ui) .then(function() { - var buildWatchResult = buildWatchTask.run(buildOptions); - - buildWatchResult.watcher.on('change', function(){ - testTask.run(commandOptions); - }); - - return buildWatchResult.completion; + return Promise.all([ + buildWatchTask.run(buildOptions), + testTask.run(commandOptions) + ]); }); } else { + // if not watching ensure karma is doing a single run + commandOptions.singleRun = true; return win.checkWindowsElevation(this.ui) .then(function() { return buildTask.run(buildOptions); diff --git a/addon/ng2/tasks/build-watch.js b/addon/ng2/tasks/build-watch.js deleted file mode 100644 index 9529b35c891c..000000000000 --- a/addon/ng2/tasks/build-watch.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -var chalk = require('chalk'); -var Task = require('ember-cli/lib/models/task'); -var Watcher = require('ember-cli/lib/models/watcher'); -var Builder = require('ember-cli/lib/models/builder'); -var Promise = require('ember-cli/lib/ext/promise'); - -module.exports = Task.extend({ - run: function(options) { - this.ui.startProgress( - chalk.green('Building'), chalk.green('.') - ); - - var watcher = new Watcher({ - ui: this.ui, - builder: new Builder({ - ui: this.ui, - outputPath: options.outputPath, - environment: options.environment, - project: this.project - }), - analytics: this.analytics, - options: options - }); - - // return the watcher to enable hooking into the build events - // return the completion promise to know when this task has ended - - return { - watcher: watcher, - completion: watcher.then(function() { - // This has been pulled in from the ember-cli build-watch implementation - // https://github.com/ember-cli/ember-cli/blob/3ea0ede89adaf1ac2a8b83036e84e792d367e727/lib/tasks/build-watch.js#L15-L27 - return new Promise(function () {}); // Run until failure or signal to exit - }) - }; - } -}); diff --git a/tests/e2e/e2e_workflow.spec.js b/tests/e2e/e2e_workflow.spec.js index 0a294d3c2990..2c5c3aff8565 100644 --- a/tests/e2e/e2e_workflow.spec.js +++ b/tests/e2e/e2e_workflow.spec.js @@ -17,7 +17,8 @@ describe('Basic end-to-end Workflow', function () { var testArgs = [ 'test', - '--single-run' + '--watch', + 'false' ]; // In travis CI only run tests in Chrome_travis_ci