From 12dd6b7550ffad6f833f22b286e291340be64b79 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 24 Jul 2015 13:47:33 -0400 Subject: [PATCH 01/10] Update ember-qunit to 0.4.6. Adds support for testing improved actions (aka closure actions). --- blueprints/app/files/bower.json | 2 +- blueprints/app/files/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprints/app/files/bower.json b/blueprints/app/files/bower.json index e59eefd330a..0337a7bdd37 100644 --- a/blueprints/app/files/bower.json +++ b/blueprints/app/files/bower.json @@ -6,7 +6,7 @@ "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", "ember-data": "1.13.5", "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5", - "ember-qunit": "0.4.2", + "ember-qunit": "0.4.6", "ember-qunit-notifications": "0.0.7", "ember-resolver": "~0.1.18", "jquery": "^1.11.1", diff --git a/blueprints/app/files/package.json b/blueprints/app/files/package.json index 42554484500..e6538e99782 100644 --- a/blueprints/app/files/package.json +++ b/blueprints/app/files/package.json @@ -29,7 +29,7 @@ "ember-cli-htmlbars-inline-precompile": "^0.1.1", "ember-cli-ic-ajax": "0.2.1", "ember-cli-inject-live-reload": "^1.3.0", - "ember-cli-qunit": "0.3.17", + "ember-cli-qunit": "0.3.18", "ember-cli-release": "0.2.3", "ember-cli-sri": "^1.0.1", "ember-cli-uglify": "^1.0.1", From 082ed03d397f7f22ace711d08b2ed59a4c08177d Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Thu, 16 Jul 2015 23:06:25 -0700 Subject: [PATCH 02/10] [fixes #4467] ensure commands that fail do to being run in the wrong context exit with the correct status code --- lib/commands/init.js | 5 +- lib/models/command.js | 14 +++-- lib/tasks/npm-task.js | 24 +++----- lib/utilities/npm.js | 23 ++++++++ tests/acceptance/brocfile-smoke-test-slow.js | 55 +------------------ tests/acceptance/smoke-test-slow.js | 46 +++------------- .../brocfile-tests/query/package.json | 6 +- tests/helpers/acceptance.js | 11 +++- tests/unit/models/command-test.js | 4 +- 9 files changed, 71 insertions(+), 117 deletions(-) create mode 100644 lib/utilities/npm.js diff --git a/lib/commands/init.js b/lib/commands/init.js index 69dd70c2e9c..4fc6644daa1 100644 --- a/lib/commands/init.js +++ b/lib/commands/init.js @@ -69,7 +69,7 @@ module.exports = Command.extend({ return Promise.reject(new SilentError(message)); } - var blueprintOpts = { + var blueprintOpts = { dryRun: commandOptions.dryRun, blueprint: commandOptions.blueprint || this._defaultBlueprint(), rawName: packageName, @@ -87,7 +87,8 @@ module.exports = Command.extend({ .then(function() { if (!commandOptions.skipNpm) { return npmInstall.run({ - verbose: commandOptions.verbose + verbose: commandOptions.verbose, + optional: false }); } }) diff --git a/lib/models/command.js b/lib/models/command.js index ba9bc9a1971..3d2fefb9f20 100644 --- a/lib/models/command.js +++ b/lib/models/command.js @@ -123,15 +123,17 @@ Command.prototype.validateAndRun = function(args) { } if (this.works === 'insideProject' && !this.isWithinProject) { - this.ui.writeLine('You have to be inside an ember-cli project in order to use ' + - 'the ' + chalk.green(this.name) + ' command.'); - return Promise.resolve(); + return Promise.reject(new SilentError( + 'You have to be inside an ember-cli project in order to use ' + + 'the ' + chalk.green(this.name) + ' command.' + )); } if (this.works === 'outsideProject' && this.isWithinProject) { - this.ui.writeLine('You cannot use the '+ chalk.green(this.name) + - ' command inside an ember-cli project.'); - return Promise.resolve(); + return Promise.reject(new SilentError( + 'You cannot use the '+ chalk.green(this.name) + + ' command inside an ember-cli project.' + )); } if (this.works === 'insideProject') { diff --git a/lib/tasks/npm-task.js b/lib/tasks/npm-task.js index 2abc075e276..93f88e4a56d 100644 --- a/lib/tasks/npm-task.js +++ b/lib/tasks/npm-task.js @@ -2,9 +2,9 @@ // Runs `npm install` in cwd -var Promise = require('../ext/promise'); -var chalk = require('chalk'); -var Task = require('../models/task'); +var chalk = require('chalk'); +var Task = require('../models/task'); +var npm = require('../utilities/npm'); module.exports = Task.extend({ // The command to run: can be 'install' or 'uninstall' @@ -25,27 +25,21 @@ module.exports = Task.extend({ loglevel: options.verbose ? 'verbose' : 'error', logstream: this.ui.outputStream, color: 'always', + // by default, do install peoples optional deps + 'optional': 'optional' in options ? options.optional : true, 'save-dev': !!options['save-dev'], 'save-exact': !!options['save-exact'] }; + var packages = options.packages || []; // npm otherwise is otherwise noisy, already submitted PR for npm to fix // misplaced console.log this.disableLogger(); - var load = Promise.denodeify(this.npm.load); - - return load(npmOptions) - .then(function() { - // if install is denodeified outside load.then(), - // it throws "Call npm.load(config, cb) before using this command." - var install = Promise.denodeify(this.npm.commands[this.command]); - - return install(packages); - }.bind(this)) - .finally(this.finally.bind(this)) - .then(this.announceCompletion.bind(this)); + return npm(this.command, packages, npmOptions, this.npm). + finally(this.finally.bind(this)). + then(this.announceCompletion.bind(this)); }, announceCompletion: function() { diff --git a/lib/utilities/npm.js b/lib/utilities/npm.js new file mode 100644 index 00000000000..f2b97e49af5 --- /dev/null +++ b/lib/utilities/npm.js @@ -0,0 +1,23 @@ +'use strict'; + +var Promise = require('../ext/promise'); + +module.exports = function npm(command, packages, options/*, npm*/) { + var lib; + if (arguments.length === 4) { + lib = arguments[3]; + } else { + lib = require('npm'); + } + + var load = Promise.denodeify(lib.load); + + return load(options) + .then(function() { + // if install is denodeified outside load.then(), + // it throws "Call npm.load(config, cb) before using this command." + var operation = Promise.denodeify(lib.commands[command]); + + return operation(packages || []); + }); +}; diff --git a/tests/acceptance/brocfile-smoke-test-slow.js b/tests/acceptance/brocfile-smoke-test-slow.js index 1ed9e747d87..8c1040b86ba 100644 --- a/tests/acceptance/brocfile-smoke-test-slow.js +++ b/tests/acceptance/brocfile-smoke-test-slow.js @@ -22,32 +22,27 @@ var existsSync = require('exists-sync'); var appName = 'some-cool-app'; describe('Acceptance: brocfile-smoke-test', function() { + this.timeout(400000); + before(function() { - this.timeout(360000); return createTestTargets(appName); }); after(function() { - this.timeout(15000); return teardownTestTargets(); }); beforeEach(function() { - this.timeout(360000); return linkDependencies(appName); }); afterEach(function() { - this.timeout(15000); return cleanupRun().then(function() { assertDirEmpty('tmp'); }); }); it('a custom EmberENV in config/environment.js is used for window.EmberENV', function() { - this.timeout(450000); - - return copyFixtureFiles('brocfile-tests/custom-ember-env') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); @@ -63,8 +58,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('a custom environment config can be used in Brocfile.js', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/custom-environment-config') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); @@ -72,8 +65,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('using wrapInEval: true', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/wrap-in-eval') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); @@ -81,8 +72,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('without app/templates', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/pods-templates') .then(function(){ // remove ./app/templates @@ -93,8 +82,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('strips app/styles or app/templates from JS', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/styles-and-templates-stripped') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); @@ -110,7 +97,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('should fall back to the Brocfile', function() { - this.timeout(100000); return copyFixtureFiles('brocfile-tests/no-ember-cli-build').then(function() { fs.removeSync('./ember-cli-build.js'); return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); @@ -121,7 +107,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('should use the Brocfile if both a Brocfile and ember-cli-build exist', function() { - this.timeout(100000); return copyFixtureFiles('brocfile-tests/both-build-files').then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); }).then(function(result) { @@ -137,8 +122,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('should throw if no build file is found', function() { - this.timeout(100000); - fs.removeSync('./ember-cli-build.js'); return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent').catch(function(err) { expect(err.code).to.eql(1); @@ -146,8 +129,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('using autoRun: true', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/auto-run-true') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); @@ -162,7 +143,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('using autoRun: false', function() { - this.timeout(100000); return copyFixtureFiles('brocfile-tests/auto-run-false') .then(function() { @@ -178,17 +158,13 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('default development build does not fail', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/query') .then(function() { - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build'); }); }); it('default development build tests', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/default-development') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); @@ -196,8 +172,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('app.import works properly with non-js/css files', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/app-import') .then(function() { var packageJsonPath = path.join(__dirname, '..', '..', 'tmp', appName, 'package.json'); @@ -219,8 +193,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('app.import fails when options.type is not `vendor` or `test`', function(){ - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/app-import') .then(function() { var packageJsonPath = path.join(__dirname, '..', '..', 'tmp', appName, 'package.json'); @@ -240,8 +212,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('addons can have a public tree that is merged and returned namespaced by default', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/public-tree') .then(function() { var packageJsonPath = path.join(__dirname, '..', '..', 'tmp', appName, 'package.json'); @@ -263,8 +233,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('using pods based templates', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/pods-templates') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); @@ -272,8 +240,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('using pods based templates with a podModulePrefix', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/pods-with-prefix-templates') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); @@ -281,8 +247,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('addon trees are not jshinted', function() { - this.timeout(450000); - return copyFixtureFiles('brocfile-tests/jshint-addon') .then(function() { var packageJsonPath = path.join(__dirname, '..', '..', 'tmp', appName, 'package.json'); @@ -308,8 +272,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('specifying custom output paths works properly', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/custom-output-paths') .then(function () { var themeCSSPath = path.join(__dirname, '..', '..', 'tmp', appName, 'app', 'styles', 'theme.css'); @@ -338,8 +300,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('multiple css files in app/styles/ are output when a preprocessor is not used', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/multiple-css-files') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent'); @@ -358,9 +318,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('specifying partial `outputPaths` hash deep merges options correctly', function() { - - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/custom-output-paths') .then(function () { @@ -400,8 +357,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('multiple paths can be CSS preprocessed', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/multiple-sass-files') .then(function() { var packageJsonPath = path.join(__dirname, '..', '..', 'tmp', appName, 'package.json'); @@ -427,8 +382,6 @@ describe('Acceptance: brocfile-smoke-test', function() { }); it('app.css is output to .css by default', function() { - this.timeout(100000); - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent') .then(function() { var exists = existsSync(path.join('.', 'dist', 'assets', appName + '.css')); @@ -439,8 +392,6 @@ describe('Acceptance: brocfile-smoke-test', function() { // for backwards compat. it('app.scss is output to .css by default', function() { - this.timeout(100000); - return copyFixtureFiles('brocfile-tests/multiple-sass-files') .then(function() { var brocfilePath = path.join(__dirname, '..', '..', 'tmp', appName, 'ember-cli-build.js'); diff --git a/tests/acceptance/smoke-test-slow.js b/tests/acceptance/smoke-test-slow.js index 62ae976a321..545f53353b5 100644 --- a/tests/acceptance/smoke-test-slow.js +++ b/tests/acceptance/smoke-test-slow.js @@ -19,41 +19,33 @@ var linkDependencies = acceptance.linkDependencies; var cleanupRun = acceptance.cleanupRun; describe('Acceptance: smoke-test', function() { + this.timeout(400000); before(function() { - this.timeout(360000); return createTestTargets(appName); }); after(function() { - this.timeout(20000); return teardownTestTargets(); }); beforeEach(function() { - this.timeout(20000); return linkDependencies(appName); }); afterEach(function() { - this.timeout(20000); - return cleanupRun().then(function() { assertDirEmpty('tmp'); }); }); it('ember new foo, clean from scratch', function() { - this.timeout(450000); - - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent'); + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test'); }); it('ember test exits with non-zero when tests fail', function() { - this.timeout(450000); - return copyFixtureFiles('smoke-tests/failing-test') .then(function() { - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test') .then(function() { expect(false, 'should have rejected with a failing test'); }) @@ -64,11 +56,9 @@ describe('Acceptance: smoke-test', function() { }); it('ember test exits with non-zero when build fails', function() { - this.timeout(450000); - return copyFixtureFiles('smoke-tests/test-with-syntax-error') .then(function() { - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test') .then(function() { expect(false, 'should have rejected with a failing test'); }) @@ -79,11 +69,9 @@ describe('Acceptance: smoke-test', function() { }); it('ember test exits with non-zero when no tests are run', function() { - this.timeout(450000); - return copyFixtureFiles('smoke-tests/no-testem-launchers') .then(function() { - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test') .then(function() { expect(false, 'should have rejected with a failing test'); }) @@ -94,9 +82,7 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, build production and verify fingerprint', function() { - this.timeout(360000); - - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production') .then(function() { var dirPath = path.join('.', 'dist', 'assets'); var dir = fs.readdirSync(dirPath); @@ -127,11 +113,9 @@ describe('Acceptance: smoke-test', function() { }); it('ember test --environment=production', function() { - this.timeout(450000); - return copyFixtureFiles('smoke-tests/passing-test') .then(function() { - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--environment=production', '--silent'); + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'test', '--environment=production'); }) .then(function(result) { var exitCode = result.code; @@ -145,9 +129,7 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, build development, and verify generated files', function() { - this.timeout(360000); - - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build') .then(function() { var dirPath = path.join('.', 'dist'); var paths = walkSync(dirPath); @@ -157,12 +139,10 @@ describe('Acceptance: smoke-test', function() { }); it('ember build exits with non-zero code when build fails', function () { - this.timeout(360000); - var appJsPath = path.join('.', 'app', 'app.js'); var ouputContainsBuildFailed = false; - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--silent') + return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build') .then(function (result) { expect(result.code).to.equal(0, 'expected exit code to be zero, but got ' + result.code); @@ -188,8 +168,6 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, build --watch development, and verify rebuilt after change', function() { - this.timeout(360000); - var touched = false; var appJsPath = path.join('.', 'app', 'app.js'); var builtJsPath = path.join('.', 'dist', 'assets', 'some-cool-app.js'); @@ -220,8 +198,6 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, build --watch development, and verify rebuilt after multiple changes', function() { - this.timeout(360000); - var buildCount = 0; var touched = false; var appJsPath = path.join('.', 'app', 'app.js'); @@ -263,8 +239,6 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, server, SIGINT clears tmp/', function() { - this.timeout(360000); - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'server', '--port=54323','--live-reload=false', { onOutput: function(string, child) { if (string.match(/Build successful/)) { @@ -278,7 +252,6 @@ describe('Acceptance: smoke-test', function() { }); it('ember new foo, build production and verify css files are concatenated', function() { - this.timeout(450000); return copyFixtureFiles('with-styles') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', '--environment=production') @@ -298,7 +271,6 @@ describe('Acceptance: smoke-test', function() { }); it('ember can override and reuse the built-in blueprints', function() { - this.timeout(450000); return copyFixtureFiles('addon/with-blueprint-override') .then(function() { return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'generate', 'component', 'foo-bar', '-p'); diff --git a/tests/fixtures/brocfile-tests/query/package.json b/tests/fixtures/brocfile-tests/query/package.json index b96736ba89e..fdca49b9240 100644 --- a/tests/fixtures/brocfile-tests/query/package.json +++ b/tests/fixtures/brocfile-tests/query/package.json @@ -1,3 +1,7 @@ { - "name": "query" + "name": "query", + "dependencies": { + "ember-cli": "*", + "ember-cli-htmlbars": "0.7.9" + } } diff --git a/tests/helpers/acceptance.js b/tests/helpers/acceptance.js index 60cd9277269..def8b042d04 100644 --- a/tests/helpers/acceptance.js +++ b/tests/helpers/acceptance.js @@ -10,6 +10,7 @@ var conf = require('./conf'); var existsSync = require('exists-sync'); var copy = Promise.denodeify(require('cpr')); var root = process.cwd(); +var npm = require('../../lib/utilities/npm'); var onOutput = { onOutput: function() { @@ -108,8 +109,14 @@ function createTestTargets(projectName, options) { } return createTmp(function() { - return command(); - }).catch(handleResult).finally(function () { + return command(). + catch(handleResult). + then(function(value) { + return npm('install', ['ember-disable-prototype-extensions'], { '--no-optional': true }). + then(function(){ + return value; + }); + }); }); } diff --git a/tests/unit/models/command-test.js b/tests/unit/models/command-test.js index 25facd5106f..07dc4de30af 100644 --- a/tests/unit/models/command-test.js +++ b/tests/unit/models/command-test.js @@ -191,7 +191,7 @@ describe('models/command.js', function() { analytics: analytics, project: { isEmberCLIProject: function(){ return false; }}, settings: {} - }).validateAndRun([]).then(function() { + }).validateAndRun([]).catch(function() { expect(ui.output).to.match(/You have to be inside an ember-cli project/); }); }); @@ -202,7 +202,7 @@ describe('models/command.js', function() { analytics: analytics, project: { isEmberCLIProject: function(){ return true; }}, settings: {} - }).validateAndRun([]).then(function() { + }).validateAndRun([]).catch(function() { expect(ui.output).to.match(/You cannot use.*inside an ember-cli project/); }); }); From 60065b306d1373261093bd9eb0f2c44ab5fb2c36 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Fri, 24 Jul 2015 17:26:42 -0700 Subject: [PATCH 03/10] bump windows vm mem/cpu/vram so dev in it is more pleasant. --- dev/windows/Vagrantfile | 5 ++++- tests/helpers/acceptance.js | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dev/windows/Vagrantfile b/dev/windows/Vagrantfile index 6f08724dd45..c79f5d7a912 100644 --- a/dev/windows/Vagrantfile +++ b/dev/windows/Vagrantfile @@ -5,7 +5,10 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.gui = true - vb.cpus = 1 + vb.cpus = 2 + vb.memory = 2048 + vb.customize ["modifyvm", :id, "--vram", "256"] + end config.vm.provision "shell", path: "install.ps1" diff --git a/tests/helpers/acceptance.js b/tests/helpers/acceptance.js index def8b042d04..463b59157c3 100644 --- a/tests/helpers/acceptance.js +++ b/tests/helpers/acceptance.js @@ -86,13 +86,14 @@ function createTestTargets(projectName, options) { options = options || {}; options.command = options.command || 'new'; + var noNodeModules = !downloaded('node_modules'); // Fresh install - if (!downloaded('node_modules') && !downloaded('bower_components')) { + if (noNodeModules && !downloaded('bower_components')) { command = function() { return applyCommand(options.command, projectName); }; // bower_components but no node_modules - } else if (!downloaded('node_modules') && downloaded('bower_components')) { + } else if (noNodeModules && downloaded('bower_components')) { command = function() { return applyCommand(options.command, projectName, '--skip-bower'); }; @@ -112,10 +113,14 @@ function createTestTargets(projectName, options) { return command(). catch(handleResult). then(function(value) { - return npm('install', ['ember-disable-prototype-extensions'], { '--no-optional': true }). - then(function(){ + if (noNodeModules) { + return npm('install', ['ember-disable-prototype-extensions'], { '--no-optional': true }). + then(function(){ return value; }); + } + + return value; }); }); } From b6ddeaf017e70acff72da04179b82c34649f5020 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 25 Jul 2015 06:05:27 -0700 Subject: [PATCH 04/10] prevent trying to initAddon twice in the same test ultimately causing it to fail. --- tests/acceptance/addon-dummy-destroy-test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/acceptance/addon-dummy-destroy-test.js b/tests/acceptance/addon-dummy-destroy-test.js index 1327d39ce54..6cc7a449383 100644 --- a/tests/acceptance/addon-dummy-destroy-test.js +++ b/tests/acceptance/addon-dummy-destroy-test.js @@ -54,9 +54,7 @@ describe('Acceptance: ember destroy in-addon-dummy', function() { function generateInAddon(args) { var generateArgs = ['generate'].concat(args); - return initAddon().then(function() { - return ember(generateArgs); - }); + return ember(generateArgs); } function destroy(args) { From 11ace263618941490f043c674da73a65d1cca5ad Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 25 Jul 2015 06:12:04 -0700 Subject: [PATCH 05/10] log current commit sha before run --- appveyor.yml | 1 + tests/acceptance/addon-destroy-test.js | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6cad0b76062..bb5fef27358 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,7 @@ environment: # Install scripts. (runs after repo cloning) install: + - git rev-parse HEAD # Get the latest stable version of Node 0.STABLE.latest - ps: Install-Product node $env:nodejs_version # Install PhantomJS diff --git a/tests/acceptance/addon-destroy-test.js b/tests/acceptance/addon-destroy-test.js index 5cbc3eb483c..51a6f2e1077 100644 --- a/tests/acceptance/addon-destroy-test.js +++ b/tests/acceptance/addon-destroy-test.js @@ -54,9 +54,7 @@ describe('Acceptance: ember destroy in-addon', function() { function generateInAddon(args) { var generateArgs = ['generate'].concat(args); - return initAddon().then(function() { - return ember(generateArgs); - }); + return ember(generateArgs); } function destroy(args) { From e8b19cbc9bb4b53eccb72cc5d260a7c4a89865c9 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 25 Jul 2015 06:30:49 -0700 Subject: [PATCH 06/10] unify timeouts in slow blueprint tests --- tests/acceptance/blueprint-test-slow.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/blueprint-test-slow.js b/tests/acceptance/blueprint-test-slow.js index 115fb3e98ea..bc1de5bacf0 100644 --- a/tests/acceptance/blueprint-test-slow.js +++ b/tests/acceptance/blueprint-test-slow.js @@ -15,31 +15,27 @@ var cleanupRun = acceptance.cleanupRun; var appName = 'some-cool-app'; describe('Acceptance: blueprint smoke tests', function() { + this.timeout(400000); + before(function() { - this.timeout(360000); return createTestTargets(appName); }); after(function() { - this.timeout(15000); return teardownTestTargets(); }); beforeEach(function() { - this.timeout(10000); return linkDependencies(appName); }); afterEach(function() { - this.timeout(10000); return cleanupRun().then(function() { assertDirEmpty('tmp'); }); }); it('generating an http-proxy installs packages to package.json', function() { - this.timeout(450000); - return runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'generate', 'http-proxy', 'api', From e22f56f601db02572d21ba0b0b1f96a99837910d Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 25 Jul 2015 07:31:26 -0700 Subject: [PATCH 07/10] add improved test logging --- tests/helpers/run-command.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/helpers/run-command.js b/tests/helpers/run-command.js index e2de42ab150..c9e51e16969 100644 --- a/tests/helpers/run-command.js +++ b/tests/helpers/run-command.js @@ -29,7 +29,7 @@ module.exports = function run(/* command, args, options */) { }); return new RSVP.Promise(function(resolve, reject) { - console.log(' Running: ' + command + ' ' + args.join(' ')); + console.log(' Running: ' + command + ' ' + args.join(' ') + ' in: ' + process.cwd()); var opts = {}; if (process.platform === 'win32') { From 47238b03e5d4eb584ce009030fc3cfa97d7cf56c Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 25 Jul 2015 08:31:14 -0700 Subject: [PATCH 08/10] bump sourcemap-concat --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 75d0410fe6d..0e013437adc 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "broccoli-kitchen-sink-helpers": "0.2.7", "broccoli-merge-trees": "0.2.1", "broccoli-sane-watcher": "^1.1.1", - "broccoli-sourcemap-concat": "1.0.0", + "broccoli-sourcemap-concat": "^1.0.0", "broccoli-unwatched-tree": "0.1.1", "broccoli-writer": "0.1.1", "chalk": "1.1.0", From 14e9dd5bb30c451191e0f7f766e28121282ca74d Mon Sep 17 00:00:00 2001 From: "David J. Hamilton" Date: Sun, 26 Jul 2015 13:17:11 -0700 Subject: [PATCH 09/10] Fix tests. --- tests/unit/models/command-test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/models/command-test.js b/tests/unit/models/command-test.js index 07dc4de30af..91fbd880795 100644 --- a/tests/unit/models/command-test.js +++ b/tests/unit/models/command-test.js @@ -191,8 +191,8 @@ describe('models/command.js', function() { analytics: analytics, project: { isEmberCLIProject: function(){ return false; }}, settings: {} - }).validateAndRun([]).catch(function() { - expect(ui.output).to.match(/You have to be inside an ember-cli project/); + }).validateAndRun([]).catch(function(reason) { + expect(reason.message).to.match(/You have to be inside an ember-cli project/); }); }); @@ -202,8 +202,8 @@ describe('models/command.js', function() { analytics: analytics, project: { isEmberCLIProject: function(){ return true; }}, settings: {} - }).validateAndRun([]).catch(function() { - expect(ui.output).to.match(/You cannot use.*inside an ember-cli project/); + }).validateAndRun([]).catch(function(reason) { + expect(reason.message).to.match(/You cannot use.*inside an ember-cli project/); }); }); From a66d5c418826868216fd8587d26a789f78a424c0 Mon Sep 17 00:00:00 2001 From: "David J. Hamilton" Date: Sun, 26 Jul 2015 14:21:49 -0700 Subject: [PATCH 10/10] runner accepts multiple files in argv - runner test timeout infinity --- tests/runner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/runner.js b/tests/runner.js index e7375272db1..57f924a674d 100644 --- a/tests/runner.js +++ b/tests/runner.js @@ -17,7 +17,7 @@ var root = 'tests/{unit,acceptance}'; var _checkOnlyInTests = RSVP.denodeify(mochaOnlyDetector.checkFolder.bind(null, root + '/**/*{-test,-slow}.js')); var optionOrFile = process.argv[2]; var mocha = new Mocha({ - timeout: 5000, + timeout: Infinity, reporter: 'spec' }); var testFiles = glob.sync(root + '/**/*-test.js'); @@ -29,8 +29,8 @@ testFiles = jshint.concat(testFiles); if (optionOrFile === 'all') { addFiles(mocha, testFiles); addFiles(mocha, '/**/*-slow.js'); -} else if (optionOrFile) { - mocha.addFile(optionOrFile); +} else if (process.argv.length > 1) { + addFiles(mocha, process.argv.slice(2)); } else { addFiles(mocha, testFiles); }