summaryrefslogtreecommitdiffstats
path: root/autotest-js.sh
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-01-23 12:43:05 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2014-01-23 12:43:05 -0800
commit9fa788c452403646cc5c2a7c0fe875879e7082fa (patch)
tree1288c4e16305f9132c5acfc3049650a65dc9fa9f /autotest-js.sh
parent5956277ed4db26f46f14eed4a6805038001dde30 (diff)
parentf29bd1cb0b839f81bed0b87ae7900da2b1d0e474 (diff)
downloadnextcloud-server-9fa788c452403646cc5c2a7c0fe875879e7082fa.tar.gz
nextcloud-server-9fa788c452403646cc5c2a7c0fe875879e7082fa.zip
Merge pull request #6736 from owncloud/tests-jsunittests
Added Javascript unit tests
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
+