#!/bin/sh

# script/test: Run test suite for application. Optionallly pass in a path to an
#              individual test file to run a single test.


set -e

cd "$(dirname "$0")/.."

[ -z "$DEBUG" ] || set -x

echo "===> Running tests..."

node node_modules/.bin/istanbul cover _mocha -- -R spec -t 10000 --require test/common.js $@

if [ ! -z "$EXPORT_COVERAGE" ]; then
	cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

	rm -rf ./coverage
fi

