#!/bin/sh

set -e

rm -rf coverage

count=1;
for file in $(find t -name \*.t.js); do
  node_modules/.bin/istanbul cover -x 't/**' $file > /dev/null 2>&1
  mv coverage/coverage.json coverage/coverage$count.json
  count=$(expr $count + 1)
done

node_modules/.bin/istanbul report --root coverage --dir coverage > /dev/null

sed -i -e s,'^SF:'`pwd`/,SF:, coverage/lcov.info

exit 0
