#!/bin/sh
# Usage:
# ./scripts/cov [reporter]
#
# Example:
# ./scripts/cov html-cov > cov.html

COV=./node_modules/coffee-coverage/bin/coffeecoverage
MOCHA=./node_modules/mocha/bin/mocha

REPORTER=$1
echo "Using Mocha reporter: $REPORTER" 1>&2
$COV --exclude node_modules,.git,test --path relative . ./src-cov 1>&2
cp -r ./test ./src-cov/test
cp ./package.json ./src-cov
find ./src-cov/test/unit | grep "\-test" | xargs $MOCHA  --reporter $REPORTER --compilers 'coffee:coffee-script'

rm -rf ./src-cov
