diff --git a/package.json b/package.json index 5efa09711..27bbc9313 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "main": "lib/protractor.js", "scripts": { - "test": "scripts/test.sh" + "test": "scripts/test.js" }, "license": "MIT", "version": "0.20.1", diff --git a/scripts/test.js b/scripts/test.js new file mode 100755 index 000000000..376276464 --- /dev/null +++ b/scripts/test.js @@ -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)); diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index eb4076bf8..000000000 --- a/scripts/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -node lib/cli.js spec/basicConf.js -node lib/cli.js spec/multiConf.js -node lib/cli.js spec/altRootConf.js -node lib/cli.js spec/onPrepareConf.js -node lib/cli.js spec/mochaConf.js -node 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 --suite okspec -node_modules/.bin/minijasminenode jasminewd/spec/adapterSpec.js spec/unit/*.js docs/spec/*.js