From 452a724542174a95ccd494be7ed58a6eddc1e31a Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sun, 15 Mar 2015 13:51:41 -0700 Subject: [PATCH] chore(test): make it easier to run all JS and Dart tests Performed a slight refactoring of CI scripts to make it easier for developers to run the **same** tests as those run on Travis. Defined `npm` scripts `test-js` and `test-dart`. `npm test` now runs the whole lot. Closes #966 --- package.json | 6 ++++-- scripts/ci/build_and_test.sh | 6 +----- scripts/ci/test_dart.sh | 11 +++++++++++ scripts/ci/test_e2e_dart.sh | 2 +- scripts/ci/test_e2e_js.sh | 2 +- scripts/ci/test_js.sh | 11 +++++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) create mode 100755 scripts/ci/test_dart.sh create mode 100755 scripts/ci/test_js.sh diff --git a/package.json b/package.json index 2a29cd9e05..17234f5cc8 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "url": "https://github.com/angular/angular.git" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "postinstall": "bower install" + "test": "npm run test-js && npm run test-dart", + "test-js": "./scripts/ci/test_js.sh", + "test-dart": "./scripts/ci/test_dart.sh", + "postinstall": "./node_modules/.bin/bower install" }, "dependencies": { "es6-module-loader": "^0.9.2", diff --git a/scripts/ci/build_and_test.sh b/scripts/ci/build_and_test.sh index 2192043496..5d7165af8d 100755 --- a/scripts/ci/build_and_test.sh +++ b/scripts/ci/build_and_test.sh @@ -9,8 +9,4 @@ SCRIPT_DIR=$(dirname $0) cd $SCRIPT_DIR/../.. ${SCRIPT_DIR}/build_$MODE.sh -${SCRIPT_DIR}/test_unit_$MODE.sh -if [ "$MODE" == "dart" ]; then # JS doesn't yet have server tests - ${SCRIPT_DIR}/test_server_$MODE.sh -fi -${SCRIPT_DIR}/test_e2e_$MODE.sh +${SCRIPT_DIR}/test_$MODE.sh diff --git a/scripts/ci/test_dart.sh b/scripts/ci/test_dart.sh new file mode 100755 index 0000000000..bc481d60e6 --- /dev/null +++ b/scripts/ci/test_dart.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +cd $SCRIPT_DIR/../.. + +${SCRIPT_DIR}/test_unit_dart.sh +${SCRIPT_DIR}/test_server_dart.sh +${SCRIPT_DIR}/test_e2e_dart.sh diff --git a/scripts/ci/test_e2e_dart.sh b/scripts/ci/test_e2e_dart.sh index cad86c1049..4d7e97ef8f 100755 --- a/scripts/ci/test_e2e_dart.sh +++ b/scripts/ci/test_e2e_dart.sh @@ -21,4 +21,4 @@ trap killServer EXIT # wait for server to come up! sleep 10 -./node_modules/.bin/protractor protractor-dart2js.conf.js --browsers=$E2E_BROWSERS \ No newline at end of file +./node_modules/.bin/protractor protractor-dart2js.conf.js --browsers=${E2E_BROWSERS:-Dartium} diff --git a/scripts/ci/test_e2e_js.sh b/scripts/ci/test_e2e_js.sh index 3e151ff73d..53928a2974 100755 --- a/scripts/ci/test_e2e_js.sh +++ b/scripts/ci/test_e2e_js.sh @@ -21,4 +21,4 @@ trap killServer EXIT # wait for server to come up! sleep 10 -./node_modules/.bin/protractor protractor-js.conf.js --browsers=$E2E_BROWSERS +./node_modules/.bin/protractor protractor-js.conf.js --browsers=${E2E_BROWSERS:-Dartium} diff --git a/scripts/ci/test_js.sh b/scripts/ci/test_js.sh new file mode 100755 index 0000000000..5ec3a5a043 --- /dev/null +++ b/scripts/ci/test_js.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo ============================================================================= +# go to project dir +SCRIPT_DIR=$(dirname $0) +cd $SCRIPT_DIR/../.. + +${SCRIPT_DIR}/test_unit_js.sh +# ${SCRIPT_DIR}/test_server_js.sh # JS doesn't yet have server tests +${SCRIPT_DIR}/test_e2e_js.sh