2016-01-12 13:08:43 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2013-07-26 20:31:24 +02:00
|
|
|
|
2013-08-20 06:15:41 +02:00
|
|
|
cd "$(dirname "$0")"/..
|
2013-07-27 00:03:46 +02:00
|
|
|
|
2013-12-02 23:46:09 +01:00
|
|
|
export NODE_PATH=/usr/lib/nodejs:static
|
2013-08-01 17:53:10 +02:00
|
|
|
|
2016-07-30 16:43:28 +02:00
|
|
|
INDEX_JS=frontend_tests/zjsunit/index.js
|
2013-07-30 23:54:33 +02:00
|
|
|
NODEJS=$(which nodejs || which node)
|
2015-09-26 03:47:30 +02:00
|
|
|
if [ "$1" = "cover" ]; then
|
2013-08-20 06:20:02 +02:00
|
|
|
# Run a coverage test with Istanbul.
|
2016-08-02 22:45:11 +02:00
|
|
|
istanbul cover "$INDEX_JS" && echo "Test(s) passed. SUCCESS!" || echo "FAIL - Test(s) failed"
|
2016-07-06 19:57:17 +02:00
|
|
|
|
|
|
|
elif [ "$1" = "-h" -o "$1" = "--help" ]; then
|
|
|
|
echo "Usage:
|
|
|
|
`basename $0` - to run all tests
|
|
|
|
`basename $0` util.js - to run tests from util.js
|
|
|
|
`basename $0` util.js activity.js - to run tests from util.js and activity.js
|
|
|
|
"
|
|
|
|
exit 0
|
|
|
|
|
2013-08-20 06:20:02 +02:00
|
|
|
else
|
|
|
|
# Normal testing, no coverage analysis.
|
|
|
|
# Run the index.js test runner, which runs all the other tests.
|
2016-08-02 22:45:11 +02:00
|
|
|
"$NODEJS" --stack-trace-limit=100 "$INDEX_JS" $@ && echo "Test(s) passed. SUCCESS!" || echo "FAIL - Test(s) failed"
|
2013-08-20 06:20:02 +02:00
|
|
|
fi
|