X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=scripts%2Frun-tests.sh;fp=scripts%2Frun-tests.sh;h=4b1c77f0fb5fa374365967fe8fbcc65577ca84d0;hb=ce31caf22475e3e1fd6d9fea192d61ff4fcd7fac;hp=0000000000000000000000000000000000000000;hpb=a4c3ece0a11e4e5c4f1f51a8bc8b7878d34ee052;p=dygraphs.git diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh new file mode 100755 index 0000000..4b1c77f --- /dev/null +++ b/scripts/run-tests.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Starts the http-server and runs mocha-phantomjs-based tests +# Note that you must run `npm run build` or `npm run watch` before running this. +set -o errexit + +# Run http-server and save its PID +http-server -p 8081 > /dev/null & +SERVER_PID=$! +function finish() { + kill -TERM $SERVER_PID +} +trap finish EXIT + +# the following sleep step is not really necessary +# as http-server starts almost instantenously; +# but letting the server settle might help prevent +# possible racing conditions +sleep 1 + +# Start the tests +mocha-phantomjs http://localhost:8081/auto_tests/runner.html