summaryrefslogtreecommitdiff
path: root/run_tests.sh
diff options
context:
space:
mode:
authorPeter Belanyi <pbelanyi@redhat.com>2014-06-04 15:35:06 +0200
committerPeter Belanyi <pbelanyi@redhat.com>2014-06-26 14:00:45 +0200
commit0a83ae972e422bbda9b74ec5a18bfd9895af20ef (patch)
tree435cf06fd8162b6b0f31b17c694a1c587bb2a510 /run_tests.sh
parent108898e7d382068df68dc21cd1677d8e55e99dae (diff)
downloadhorizon-0a83ae972e422bbda9b74ec5a18bfd9895af20ef.tar.gz
Add jshint for javascript linting
Added nodeenv as a test requirement. Added a jshint environment to tox.ini, which installs node.js into the python virtual environment with nodeenv, installs jshint using npm, and calls runtest.sh to run the tests. runtest.sh now supports the -j|--jshint flags to run jshint on the javascript files. jshint must be installed before running runtest.sh The documentation also got updated to include some info about jshint. This patch does not add jshint to the OpenStack codebase, just provides a way to install it for testing, to avoid license clash (jshint has a slightly modified MIT license, which is incompatible with OpenStack's Apache license). Change-Id: I9dd0743eaee50fdba3dbb527c29f2501bdd44ca6 Implements: blueprint node-toolchain Implements: blueprint jshint-codestyle
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh
index 2f55dc84e..57dd06408 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -28,6 +28,7 @@ function usage {
echo " -P, --no-pep8 Don't run pep8 by default"
echo " -t, --tabs Check for tab characters in files."
echo " -y, --pylint Just run pylint"
+ echo " -j, --jshint Just run jshint"
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
echo " Implies -V if -N is not set."
echo " --only-selenium Run only the Selenium unit tests"
@@ -67,6 +68,7 @@ no_pep8=0
just_pylint=0
just_docs=0
just_tabs=0
+just_jshint=0
never_venv=0
quiet=0
restore_env=0
@@ -98,6 +100,7 @@ function process_option {
-p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;;
-y|--pylint) just_pylint=1;;
+ -j|--jshint) just_jshint=1;;
-f|--force) force=1;;
-t|--tabs) just_tabs=1;;
-q|--quiet) quiet=1;;
@@ -142,6 +145,12 @@ function run_pylint {
fi
}
+function run_jshint {
+ echo "Running jshint ..."
+ jshint horizon/static/horizon/js
+ jshint horizon/static/horizon/tests
+}
+
function run_pep8 {
echo "Running flake8 ..."
set +o errexit
@@ -477,6 +486,12 @@ if [ $just_pylint -eq 1 ]; then
exit $?
fi
+# Jshint
+if [ $just_jshint -eq 1 ]; then
+ run_jshint
+ exit $?
+fi
+
# Tab checker
if [ $just_tabs -eq 1 ]; then
tab_check