aboutsummaryrefslogtreecommitdiffstats
path: root/autotest-js.sh
diff options
context:
space:
mode:
authorPellaeon Lin <nfsmwlin@gmail.com>2014-01-30 22:50:20 +0800
committerPellaeon Lin <nfsmwlin@gmail.com>2014-01-30 22:50:20 +0800
commit099b71c712c38de7dac7e386252da02bb0cadf12 (patch)
tree84bcf83efdc4cc759a5ff184fa5148195abaab51 /autotest-js.sh
parent929c930b0afd682bb98eb389d7ebad91bb34d643 (diff)
parent299a8285bd2601ccbac988b2e3e9b067d47921a2 (diff)
downloadnextcloud-server-099b71c712c38de7dac7e386252da02bb0cadf12.tar.gz
nextcloud-server-099b71c712c38de7dac7e386252da02bb0cadf12.zip
Merge branch 'master' into pr-exceed_upload_limit_msg
Conflicts: apps/files/templates/index.php apps/files_sharing/templates/public.php
Diffstat (limited to 'autotest-js.sh')
-rwxr-xr-xautotest-js.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/autotest-js.sh b/autotest-js.sh
new file mode 100755
index 00000000000..78f4948e7ad
--- /dev/null
+++ b/autotest-js.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# ownCloud
+#
+# Run JS tests
+#
+# @author Vincent Petry
+# @copyright 2014 Vincent Petry <pvince81@owncloud.com>
+#
+NPM="$(which npm 2>/dev/null)"
+PREFIX="build"
+
+if test -z "$NPM"
+then
+ echo 'Node JS >= 0.8 is required to run the JavaScript tests' >&2
+ exit 1
+fi
+
+# update/install test packages
+mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" || exit 3
+
+KARMA="$(which karma 2>/dev/null)"
+
+# If not installed globally, try local version
+if test -z "$KARMA"
+then
+ KARMA="$PREFIX/node_modules/karma/bin/karma"
+fi
+
+if test -z "$KARMA"
+then
+ echo 'Karma module executable not found' >&2
+ exit 2
+fi
+
+KARMA_TESTSUITE="$1" $KARMA start tests/karma.config.js --single-run
+