Merge pull request #715 from simonkwesi/patch-1
[dygraphs.git] / scripts / run-tests.sh
1 #!/bin/bash
2 # Starts the http-server and runs mocha-phantomjs-based tests
3 # Note that you must run `npm run build` or `npm run watch` before running this.
4 set -o errexit
5
6 # Run http-server and save its PID
7 http-server -p 8081 > /dev/null &
8 SERVER_PID=$!
9 function finish() {
10 kill -TERM $SERVER_PID
11 }
12 trap finish EXIT
13
14 # the following sleep step is not really necessary
15 # as http-server starts almost instantenously;
16 # but letting the server settle might help prevent
17 # possible racing conditions
18 sleep 1
19
20 # Start the tests
21 mocha-phantomjs http://localhost:8081/auto_tests/runner.html "$@"