Permalink
Browse files

Added unit test code coverage report with node-coverage

  • Loading branch information...
1 parent c90b9c8 commit 6adc22a895a4253fd775fe5bc82ec98d94b8544b @jleppert jleppert committed May 31, 2012
Showing with 51 additions and 4 deletions.
  1. +1 −0 .coverignore
  2. +20 −0 .coverrc
  3. +4 −1 .gitignore
  4. +7 −1 Makefile
  5. +17 −1 README.md
  6. +2 −1 package.json
View
@@ -0,0 +1 @@
+test
View
@@ -0,0 +1,20 @@
+{
+ "formatter": "cli",
+ "ignore": ".coverignore",
+
+ "prefix": "coveragefile_", // Prefix for coverage data files
+ "dataDirectory": ".coverage_data", // Directory to put coverage files in
+
+ "debugDirectory": ".coverage_debug", // Directory to put instrumented files in
+
+ "modules": false, // Whether or not to cover node_modules directory
+
+ // Formatter-specific info
+ "html" : {
+ "directory": "cover_html", // Directory to write HTML files too
+ "generateIndex": true // Whether to generate an index.html file
+ },
+
+ "json": {
+ }
+}
View
@@ -1 +1,4 @@
-/nbproject
+/nbproject
+node_modules
+.coverage_data
+cover_html
View
@@ -11,6 +11,12 @@ jasmine:
node test/jasmine-test/server/specRunner.js
#
+# Run code coverage and generate report
+#
+coverage:
+ cover run test/server.js && cover report && cover report html
+
+#
# Run the benchmarks
#
bench:
@@ -83,4 +89,4 @@ release: clean docs min
git tag -a -m "version v${VERSION}" v${VERSION}
npm publish
-.PHONY: test docs bench parser
+.PHONY: test docs bench parser
View
@@ -66,4 +66,20 @@ registered under the same name as the source file:
You can customize the name under which the template is registered:
- $ dustc --name=mytemplate template.html
+ $ dustc --name=mytemplate template.html
+
+Running Tests
+------------
+
+To run tests:
+
+ $ make test
+
+To generate code coverage report:
+
+ $ npm install cover -g
+ $ make coverage
+
+To view HTML test coverage report:
+
+ $ open cover_html/index.html
View
@@ -25,7 +25,8 @@
},
"keywords": ["templates", "views"],
"devDependencies": {
- "jasmine-node" : "1.0.x"
+ "jasmine-node" : "1.0.x",
+ "cover" : "0.2.x"
},
"license": "MIT",
"engine": {

0 comments on commit 6adc22a

Please sign in to comment.