Permalink
Browse files

Added code coverage report.

  • Loading branch information...
1 parent 9c4ed5c commit 72b095dffdb8b094aac506caebf2c09049467155 @assaf committed May 11, 2012
Showing with 26 additions and 6 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 .npmignore
  3. +19 −5 Makefile
  4. +1 −0 doc/layout/main.html
  5. +4 −1 test/helpers/index.coffee
View
@@ -3,3 +3,4 @@ html
man7
node_modules
lib/**/*.js
+lib-cov
View
@@ -1,6 +1,7 @@
npm-debug.log
node_modules
lib/**/*.coffee
+lib-cov
Makefile
html
test
View
@@ -6,19 +6,33 @@ default : test
setup :
npm install
+# CoffeeScript to JavaScript
+build : clean
+ coffee -b -c -l -o lib/zombie lib/zombie/*.coffee
+
# Run test suite
test : setup
npm test
+# Run coverage report
+coverage : setup lib-cov
+ mkdir -p html
+ env LIB_PATH=lib-cov mocha -R html-cov > html/coverage.html
+ echo open html/coverage.html
+
+lib-cov : build
+ jscoverage --no-highlight lib lib-cov
+
+html/coverage.html :
+ if [ `which jscoverage` ] ; then make coverage ; fi
+
+
# Remove temporary files
clean :
rm -rf html man7
rm -f lib/zombie/*.js
-
-# CoffeeScript to JavaScript
-build : clean
- coffee -b -c -l -o lib/zombie lib/zombie/*.coffee
+ rm -rf lib-cov
# Documentation consists of Markdown files converted to HTML, CSS/images copied over, annotated source code and PDF.
@@ -77,7 +91,7 @@ man7/zombie-%.7 : doc/%.md
version = $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json')).version)")
# Publish site only.
-publish-docs : html html/source html/zombie.pdf
+publish-docs : html html/source html/zombie.pdf html/coverage.html
@echo "Uploading documentation ..."
rsync -chr --del --stats html/ labnotes.org:/var/www/zombie/
View
@@ -24,6 +24,7 @@
<li><a href="https://github.com/assaf/zombie">Github/Issues</a></li>
<li><a href="changelog">Changelog</a></li>
<li><a href="source/">Annotated Source</a></li>
+ <li><a href="coverage">Code Coverage</a></li>
<li><a href="http://travis-ci.org/assaf/zombie"><img src="http://travis-ci.org/assaf/zombie.png"></a></li>
</ul>
<div class="donate">
@@ -1,5 +1,8 @@
+# We switch this directory to instrumented code when running code coverage
+# report
+process.env.LIB_PATH ||= "lib"
Replay = require("replay")
-Browser = require("../../lib/zombie")
+Browser = require("../../#{process.env.LIB_PATH}/zombie")
# Always run in verbose mode on Travis.

0 comments on commit 72b095d

Please sign in to comment.