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/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/lib/commands/init.js b/lib/commands/init.js index 5df458cd40c..9c2368b9bf9 100644 --- a/lib/commands/init.js +++ b/lib/commands/init.js @@ -74,7 +74,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, 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 0603ce0ccbf..e4ac6cefd81 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,28 +25,22 @@ 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'], 'optional': 'optional' in options ? options.optional : true }; + 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/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", 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) { 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) { 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', 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 c3bf0d935f6..412621b8020 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() { @@ -85,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'); }; @@ -108,8 +110,18 @@ function createTestTargets(projectName, options) { } return createTmp(function() { - return command(); - }).catch(handleResult).finally(function () { + return command(). + catch(handleResult). + then(function(value) { + if (noNodeModules) { + return npm('install', ['ember-disable-prototype-extensions'], { '--no-optional': true }). + then(function(){ + return value; + }); + } + + return value; + }); }); } 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') { 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); } diff --git a/tests/unit/models/command-test.js b/tests/unit/models/command-test.js index 25facd5106f..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([]).then(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([]).then(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/); }); });