Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit test code coverage report with node-coverage #52

Merged
merged 1 commit into from
Jun 1, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .coverignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
20 changes: 20 additions & 0 deletions .coverrc
Original file line number Diff line number Diff line change
@@ -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": {
}
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/nbproject
/nbproject
node_modules
.coverage_data
cover_html
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ test:
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
#
Expand Down Expand Up @@ -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
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down