From 38b0bcc2eacbdd5bcfcbb09923d8b84363ac7561 Mon Sep 17 00:00:00 2001 From: Jake Luer Date: Fri, 24 Feb 2012 02:59:52 -0500 Subject: [PATCH] mocha coverage support --- .gitignore | 2 ++ Makefile | 11 +++++++++-- index.js | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index df0bd0d..770ec79 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules/ .DS_Store *.swp +coverage.html +lib-cov diff --git a/Makefile b/Makefile index fd97980..7f50543 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ chai.js: $(SRC) @node support/compile $^ clean: - rm -f chai.js + @rm -f chai.js docs: clean-docs @./node_modules/.bin/codex build \ @@ -27,4 +27,11 @@ test: --ui tdd \ $(TESTS) -.PHONY: clean test docs clean-docs +test-cov: lib-cov + @CHAI_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html + +lib-cov: + @rm -rf lib-cov + @jscoverage lib lib-cov + +.PHONY: clean test docs clean-docs test-cov lib-cov diff --git a/index.js b/index.js index f22fbd5..2c9e223 100644 --- a/index.js +++ b/index.js @@ -1 +1,3 @@ -module.exports = require('./lib/chai'); \ No newline at end of file +module.exports = process.env.CHAI_COV + ? require('./lib-cov/chai') + : require('./lib/chai');