Skip to content

Commit

Permalink
(fix): Convert test.sh to test.js
Browse files Browse the repository at this point in the history
This would enable the tests to be run on both Linux and Windows.
  • Loading branch information
Parashuram authored and juliemr committed Mar 26, 2014
1 parent 8d57b1e commit 9530a0c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"main": "lib/protractor.js",
"scripts": {
"test": "scripts/test.sh"
"test": "scripts/test.js"
},
"license": "MIT",
"version": "0.20.1",
Expand Down
43 changes: 43 additions & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env node

var glob = require('glob').sync;
var spawn = require('child_process').spawn;

var scripts = [
'lib/cli.js spec/basicConf.js',
'lib/cli.js spec/multiConf.js',
'lib/cli.js spec/altRootConf.js',
'lib/cli.js spec/onPrepareConf.js',
'lib/cli.js spec/mochaConf.js',
'lib/cli.js spec/cucumberConf.js',
'node lib/cli.js spec/withLoginConf.js',
'node lib/cli.js spec/suitesConf.js --suite okmany',
'node lib/cli.js spec/suitesConf.js'
];

scripts.push(
'node node_modules/.bin/minijasminenode jasminewd/spec/adapterSpec.js ' +
glob('spec/unit/*.js').join(' ') + ' ' +
glob('docs/spec/*.js').join(' '));

var failed = false;

(function runTests(i) {
if (i < scripts.length) {
console.log('node ' + scripts[i]);
var args = scripts[i].split(/\s/);

var test = spawn(args[0], args.slice(1), {stdio: 'inherit'});
test.on('error', function(err) {
throw err;
});
test.on('exit', function(code) {
if (code != 0) {
failed = true;
}
runTests(i + 1);
});
} else {
process.exit(failed ? 1 : 0);
}
}(0));
12 changes: 0 additions & 12 deletions scripts/test.sh

This file was deleted.

0 comments on commit 9530a0c

Please sign in to comment.