Permalink
Browse files

add jscover

  • Loading branch information...
1 parent 39f1eaf commit ee840b840974c00b85c9b76c3bb52e0df86a76a7 @lichangwei committed Feb 4, 2013
Showing with 29 additions and 9 deletions.
  1. +4 −1 .gitignore
  2. +19 −5 Makefile
  3. +2 −1 index.js
  4. +2 −1 package.json
  5. +1 −0 test/index.js
  6. +1 −1 test/string.js
View
@@ -1,4 +1,7 @@
/node_modules
/.project
-/npm-debug.log
+/npm-debug.log
+coverage.html
+
+lib-cov/*
View
@@ -1,9 +1,23 @@
-TESTS = test/*.js
+TESTS = test/index.js
REPORTER = spec
TIMEOUT = 5000
+JSCOVERAGE = ./node_modules/jscover/bin/jscover
+
+install:
+ @npm install
test:
- @NODE_ENV=test ./node_modules/mocha/bin/mocha \
- --reporter $(REPORTER) \
- --timeout $(TIMEOUT) \
- $(TESTS)
+ @NODE_ENV=test ./node_modules/mocha/bin/mocha \
+ --reporter $(REPORTER) \
+ --timeout $(TIMEOUT) \
+ $(TESTS)
+
+test-cov: lib-cov
+ @RESTJS_COV=1 $(MAKE) test
+ @RESTJS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
+
+lib-cov:
+ @rm -rf $@
+ @$(JSCOVERAGE) lib $@
+
+.PHONY: install test test-cov lib-cov
View
@@ -1 +1,2 @@
-module.exports = require('./lib/restjs');
+
+module.exports = process.env.RESTJS_COV ? require('./lib-cov/restjs') : require('./lib/restjs');
View
@@ -28,6 +28,7 @@
},
"devDependencies": {
"mocha": "*",
- "chai": "*"
+ "chai": "*",
+ "jscover": "*"
}
}
View
@@ -0,0 +1 @@
+require('./string');
View
@@ -1,5 +1,5 @@
-var assert = require('assert');
+var assert = require('chai').assert;
require('../index');

0 comments on commit ee840b8

Please sign in to comment.