aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Jones <bjones@galois.com>2013-05-23 19:42:33 -0700
committerGravatar Benjamin Jones <bjones@galois.com>2013-05-23 19:42:33 -0700
commitb90732f93bd9e649bbb9b7a9ecee911b3e332a5a (patch)
treecbfc3e07b2eef848ba7346a7dcf1120dd94adef2
parent0db7c6b6cb6326806e40c8139f27f6bf8507b03a (diff)
added EnvJasmine script and config file. You need to clone the EnvJasmine git repo to tools/EnvJasmine/ for the run script to work
-rw-r--r--contexts/data/tests/env_jasmine_deps.js45
-rwxr-xr-xtools/bin/run_jasmine_tests.sh35
2 files changed, 80 insertions, 0 deletions
diff --git a/contexts/data/tests/env_jasmine_deps.js b/contexts/data/tests/env_jasmine_deps.js
new file mode 100644
index 0000000..02ca993
--- /dev/null
+++ b/contexts/data/tests/env_jasmine_deps.js
@@ -0,0 +1,45 @@
+// Add any files here that need to be loaded before all tests are run.
+//
+// NOTE: Load order does matter.
+// Load the envjasmine environment
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "envjs/env.rhino.1.2.js");
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "jasmine/jasmine.js");
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "jasmine-ajax/mock-ajax.js");
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "jasmine-ajax/spec-helper.js");
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "jasmine-jquery/jasmine-jquery-1.2.0.js");
+EnvJasmine.loadGlobal(EnvJasmine.libDir + "jasmine-rhino-reporter/jasmine-rhino-reporter.js");
+
+// Note:
+// EnvJasmine.rootDir = $FIVEUI_ROOT/tools/EnvJasmine/
+fiveuiDir = EnvJasmine.rootDir + "../../contexts/data/fiveui/";
+fiveuiLibDir = EnvJasmine.rootDir + "../../contexts/data/lib/";
+fiveuiTestsDir = EnvJasmine.rootDir + "../../contexts/data/tests/";
+
+// Load FiveUI dependencies
+//EnvJasmine.loadGlobal(fiveuiLibDir + "jasmine/jasmine.js");
+//EnvJasmine.loadGlobal(fiveuiLibDir + "jasmine/jasmine-html.js");
+//EnvJasmine.loadGlobal(fiveuiLibDir + "jasmine/boot.js");
+EnvJasmine.loadGlobal(fiveuiLibDir + "jquery/jquery-1.8.3.js");
+EnvJasmine.loadGlobal(fiveuiLibDir + "jquery/jquery.json-2.4.js");
+EnvJasmine.loadGlobal(fiveuiLibDir + "underscore/underscore.js");
+EnvJasmine.loadGlobal(fiveuiLibDir + "backbone/backbone.js");
+
+// FiveUI + Jasmine deps
+EnvJasmine.loadGlobal(fiveuiTestsDir + "mock-storage.js");
+
+// Load all tested FiveUI js files
+EnvJasmine.loadGlobal(fiveuiDir + "set.js");
+EnvJasmine.loadGlobal(fiveuiDir + "utils.js");
+EnvJasmine.loadGlobal(fiveuiDir + "chan.js");
+EnvJasmine.loadGlobal(fiveuiDir + "rules.js");
+EnvJasmine.loadGlobal(fiveuiDir + "messenger.js");
+EnvJasmine.loadGlobal(fiveuiDir + "settings.js");
+EnvJasmine.loadGlobal(fiveuiDir + "state.js");
+EnvJasmine.loadGlobal(fiveuiDir + "injected/prelude.js");
+
+// This is your main JavaScript directory in your project.
+EnvJasmine.jsDir = EnvJasmine.rootDir + "../../contexts/data/fiveui/";
+
+// this will include the code coverage plugin
+//EnvJasmine.loadGlobal(EnvJasmine.libDir + "/jscover/envjasmine-sonar-coverage-properties.js"); // TODO: Uncomment and update if you want code coverage
+//EnvJasmine.loadGlobal(EnvJasmine.coverage.envjasmine_coverage_js); // TODO: Uncomment if you want code coverage
diff --git a/tools/bin/run_jasmine_tests.sh b/tools/bin/run_jasmine_tests.sh
new file mode 100755
index 0000000..721ac59
--- /dev/null
+++ b/tools/bin/run_jasmine_tests.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+#
+# Run Jasmine tests headless using EnvJasmine
+# (https://github.com/trevmex/EnvJasmine)
+
+usage() {
+ echo ""
+ echo "Usage:"
+ echo ""
+ echo "Set FIVEUI_ROOT environment variable."
+ echo "Run:"
+ echo "> $0 specFileName"
+ echo ""
+ echo "where specFileName is an **absolute** file path"
+ echo ""
+}
+
+[ -z "$FIVEUI_ROOT" ] && { echo "Need to set FIVEUI_ROOT"; exit 1; }
+ENV_JASMINE_ROOT=$FIVEUI_ROOT/tools/EnvJasmine/
+
+[ -z "$1" ] && { echo "No test spec specified"; usage; exit 1; }
+
+CMD="java -Dfile.encoding=utf-8 -jar \"$ENV_JASMINE_ROOT/lib/rhino/js.jar\" \
+ \"$ENV_JASMINE_ROOT/lib/envjasmine.js\" --environment=\"UNIX\" \
+ --rootDir=\"$ENV_JASMINE_ROOT\" \
+ --configFile=\"$FIVEUI_ROOT/contexts/data/tests/env_jasmine_deps.js\" "
+
+
+for (( i=1 ; i < $#+1 ; i=$i+1 )) do
+ CMD="$CMD \"${!i}\""
+done
+
+eval $CMD
+
+