diff --git a/gulpfile.js b/gulpfile.js index 2179284fc..a6d3d2030 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,8 +9,19 @@ var spawn = require('child_process').spawn; var runSpawn = function(done, task, opt_arg) { opt_arg = typeof opt_arg !== 'undefined' ? opt_arg : []; var child = spawn(task, opt_arg, {stdio: 'inherit'}); + var running = false; child.on('close', function() { - done(); + if (!running) { + running = true; + done(); + } + }); + child.on('error', function() { + if (!running) { + console.error('gulp encountered a child error'); + running = true; + done(); + } }); }; @@ -20,11 +31,11 @@ gulp.task('built:copy', function() { }); gulp.task('webdriver:update', function(done) { - runSpawn(done, 'bin/webdriver-manager', ['update']); + runSpawn(done, 'node', ['bin/webdriver-manager', 'update']); }); -gulp.task('jslint', function(done) { - runSpawn(done, './node_modules/.bin/jshint', ['lib','spec', 'scripts']); +gulp.task('jshint', function(done) { + runSpawn(done, 'node', ['node_modules/jshint/bin/jshint', 'lib', 'spec', 'scripts']); }); gulp.task('clang', function() { @@ -36,18 +47,18 @@ gulp.task('clang', function() { }); gulp.task('typings', function(done) { - runSpawn(done, 'node_modules/.bin/typings', ['install']); + runSpawn(done, 'node', ['node_modules/typings/dist/bin/typings.js', 'install']); }); gulp.task('tsc', function(done) { - runSpawn(done, './node_modules/typescript/bin/tsc'); + runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']); }); gulp.task('prepublish', function(done) { - runSequence(['typings', 'jslint', 'clang'],'tsc', 'built:copy', done); + runSequence(['typings', 'jshint', 'clang'],'tsc', 'built:copy', done); }); gulp.task('pretest', function(done) { runSequence( - ['webdriver:update', 'typings', 'jslint', 'clang'], 'tsc', 'built:copy', done); + ['webdriver:update', 'typings', 'jshint', 'clang'], 'tsc', 'built:copy', done); }); diff --git a/scripts/attachSession.js b/scripts/attachSession.js index 58822b8d5..9e195fb85 100644 --- a/scripts/attachSession.js +++ b/scripts/attachSession.js @@ -50,8 +50,8 @@ var checkSession = function() { }); res.on('end', function() { if (state === 'success') { - var runProtractor = spawn('bin/protractor', - ['spec/attachSession.js', '--seleniumSessionId=' + sessionId]); + var runProtractor = spawn('node', + ['bin/protractor', 'spec/attachSession.js', '--seleniumSessionId=' + sessionId]); console.log(runProtractor.stdout.toString()); if (runProtractor.status !== 0) { throw new Error('Protractor did not run properly.'); diff --git a/scripts/test.js b/scripts/test.js index 9558c107e..4b1e8cd8d 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -36,7 +36,7 @@ var passingTests = [ 'node scripts/interactive_tests/interactive_test.js', 'node scripts/interactive_tests/with_base_url.js', // Unit tests - 'node node_modules/.bin/jasmine JASMINE_CONFIG_PATH=scripts/unit_test.json', + 'node node_modules/jasmine/bin/jasmine.js JASMINE_CONFIG_PATH=scripts/unit_test.json', ]; var executor = new Executor(); diff --git a/spec/angular2Conf.js b/spec/angular2Conf.js index e9be73cb3..e5ca06a96 100644 --- a/spec/angular2Conf.js +++ b/spec/angular2Conf.js @@ -1,4 +1,4 @@ -var env = require('./environment.js'); +var env = require('./environment'); // This is the configuration for a smoke test for an Angular2 application. // @@ -21,7 +21,7 @@ exports.config = { capabilities: env.capabilities, - baseUrl: 'http://localhost:8081', + baseUrl: env.baseUrl, // Special option for Angular2, to test against all Angular2 applications // on the page. This means that Protractor will wait for every app to be diff --git a/spec/attachSession.js b/spec/attachSession.js index 694977e67..703417ad0 100644 --- a/spec/attachSession.js +++ b/spec/attachSession.js @@ -1,4 +1,4 @@ -var env = require('./environment.js'); +var env = require('./environment'); exports.config = { seleniumAddress: env.seleniumAddress, @@ -11,7 +11,7 @@ exports.config = { capabilities: env.capabilities, - baseUrl: 'http://localhost:8081', + baseUrl: env.baseUrl, // Special option for Angular2, to test against all Angular2 applications // on the page. This means that Protractor will wait for every app to be diff --git a/spec/driverprovider_test.js b/spec/driverprovider_test.js index a95256c8f..88347e362 100644 --- a/spec/driverprovider_test.js +++ b/spec/driverprovider_test.js @@ -13,6 +13,7 @@ var argv = require('optimist').argv; var q = require('q'); +var env = require('./environment'); var testDriverProvider = function(driverProvider) { return driverProvider.setupEnv().then(function() { @@ -64,7 +65,7 @@ testDriverProvider(require('../lib/driverProviders/direct')(firefoxConfig)). }); var hostedConfig = { - seleniumAddress: 'http://localhost:4444/wd/hub', + seleniumAddress: env.seleniumAddress, capabilities: { browserName: 'firefox' } @@ -77,7 +78,7 @@ testDriverProvider(require('../lib/driverProviders/hosted')(hostedConfig)). }); var hostedPromisedConfig = { - seleniumAddress: q.when('http://localhost:4444/wd/hub'), + seleniumAddress: q.when(env.seleniumAddress), capabilities: { browserName: 'firefox' } diff --git a/tsconfig.json b/tsconfig.json index 89448d51c..50a6a096f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "testapp", "typings/browser", "typings/browser.d.ts", - "typings/main" + "typings/main", + "website" ] }