Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(gulp): changes to gulpfile to run on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cnishina committed Feb 29, 2016
1 parent 6f7140a commit a79fd29
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
27 changes: 19 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
};

Expand All @@ -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() {
Expand All @@ -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);
});
4 changes: 2 additions & 2 deletions scripts/attachSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions spec/angular2Conf.js
Original file line number Diff line number Diff line change
@@ -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.
//
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/attachSession.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var env = require('./environment.js');
var env = require('./environment');

exports.config = {
seleniumAddress: env.seleniumAddress,
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions spec/driverprovider_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -64,7 +65,7 @@ testDriverProvider(require('../lib/driverProviders/direct')(firefoxConfig)).
});

var hostedConfig = {
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumAddress: env.seleniumAddress,
capabilities: {
browserName: 'firefox'
}
Expand All @@ -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'
}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"testapp",
"typings/browser",
"typings/browser.d.ts",
"typings/main"
"typings/main",
"website"
]
}

0 comments on commit a79fd29

Please sign in to comment.