Skip to content

Commit

Permalink
Coverage with Istanbul and Coveralls.
Browse files Browse the repository at this point in the history
  • Loading branch information
flatheadmill committed Apr 7, 2013
1 parent e089940 commit f693253
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ branches:

before_install:
- npm install
- npm install istanbul coveralls
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, "author" : "Alan Gutierrez <alan@prettyrobots.com>"
, "contributors" : []
, "devDependencies": { "proof": "0.0.27" }
, "scripts" : { "test": "proof test t/*/*.t.js" }
, "scripts" : { "test": "proof platform win32 && proof test */*/*.t.js || t/test" }
, "engines" : { "node": "> 0.8.0" }
, "homepage": "https://github.com/bigeasy/strata"
, "licenses": [
Expand Down
16 changes: 16 additions & 0 deletions t/cover
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

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

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

exit 0
22 changes: 22 additions & 0 deletions t/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

set -e

if [ "$TRAVIS" = "true" ]; then
echo '$ sudo apt-get install bc' && echo ''
sudo apt-get install -q -q bc 2> /dev/null > /dev/null
fi

echo ""

(proof run t/*/*.t.js | tee .proof.out | proof progress) || (proof errors < .proof.out) || exit 1

if [ "$TRAVIS" = "true" ]; then
echo "running with coverage"
t/cover

echo "submitting to coveralls.io"
(cat coverage/lcov.info | node_modules/.bin/coveralls) > /dev/null 2>&1
fi

echo ""

0 comments on commit f693253

Please sign in to comment.