Skip to content

Commit

Permalink
Added code coverage report.
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed May 11, 2012
1 parent 9c4ed5c commit 72b095d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ html
man7
node_modules
lib/**/*.js
lib-cov
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
npm-debug.log
node_modules
lib/**/*.coffee
lib-cov
Makefile
html
test
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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/

Expand Down
1 change: 1 addition & 0 deletions doc/layout/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
5 changes: 4 additions & 1 deletion test/helpers/index.coffee
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 72b095d

Please sign in to comment.