From b6ee5fafd0d6c79cf7df5560cb324ebee4fe3a7f Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Thu, 23 Feb 2012 20:49:50 -0800 Subject: [PATCH] Added mocha test coverage support --- Makefile | 6 ++++++ index.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8e092cb907..4ec41aea73 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,12 @@ docs: $(HTMLDOCS) | cat docs/layout/head.html - docs/layout/foot.html \ > $@ +test-cov: lib-cov + @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html + +lib-cov: + @jscoverage lib lib-cov + site: rm -fr /tmp/docs \ && cp -fr docs /tmp/docs \ diff --git a/index.js b/index.js index 8d81ea75c5..bfe99345b7 100644 --- a/index.js +++ b/index.js @@ -1,2 +1,4 @@ -module.exports = require('./lib/express'); \ No newline at end of file +module.exports = process.env.EXPRESS_COV + ? require('./lib-cov/express') + : require('./lib/express'); \ No newline at end of file