Skip to content

Commit

Permalink
Add code coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
aleafs committed Oct 30, 2012
1 parent 4a60c89 commit 68a4bba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
node_modules
lib-cov
coverage.html
test/config.json
*.log
*.tmp
*.swp
test/config.json
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TESTS = test/*.test.js
REPORTER = spec
TIMEOUT = 5000
JSCOVERAGE = ./node_modules/visionmedia-jscoverage/jscoverage
MOCHA = ./node_modules/mocha/bin/mocha

install:
Expand All @@ -10,4 +11,9 @@ test: install
@NODE_ENV=test $(MOCHA) --reporter $(REPORTER) --timeout $(TIMEOUT) \
$(MOCHA_OPTS) $(TESTS)

cov: install
@-rm -rf ./lib-cov
@$(JSCOVERAGE) ./lib ./lib-cov
@MYSQL_CLUSTER_COV=1 $(MOCHA) --reporter html-cov > ./coverage.html

.PHONY: test install
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

"use strict";

module.exports = require(__dirname + '/lib/cluster.js');
var LIBPATH = __dirname + (process.env.MYSQL_CLUSTER_COV ? '/lib-cov' : '/lib');

module.exports = require(LIBPATH + '/cluster.js');

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"devDependencies": {
"mocha" : ">=0.9.0",
"should" : ">=0.4.2",
"interceptor" : ">=0.0.2"
"interceptor" : ">=0.0.2",
"visionmedia-jscoverage" : ">=1.0.0"
},
"main": "./index.js",
"scripts": {
Expand Down

0 comments on commit 68a4bba

Please sign in to comment.