Skip to content

Commit

Permalink
support coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 24, 2013
1 parent c528634 commit 87e47bb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
@@ -1,5 +1,6 @@
language: node_js
node_js:
- 0.8
- 0.10
- 0.11
- '0.8'
- '0.10'
- '0.11'
script: make test-coveralls
22 changes: 14 additions & 8 deletions Makefile
@@ -1,7 +1,7 @@
TESTS = test/*.test.js
REPORTER = spec
TIMEOUT = 5000
JSCOVERAGE = ./node_modules/jscover/bin/jscover
MOCHA_OPTS =

install:
@npm install
Expand All @@ -10,14 +10,20 @@ test: install
@NODE_ENV=test ./node_modules/mocha/bin/mocha \
--reporter $(REPORTER) \
--timeout $(TIMEOUT) \
$(MOCHA_OPTS) \
$(TESTS)

test-cov: install lib-cov
@GRACEFUL_COV=1 $(MAKE) test REPORTER=dot
@GRACEFUL_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
test-cov:
@rm -f coverage.html
@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=html-cov > coverage.html
-@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=travis-cov
@ls -lh coverage.html

lib-cov:
@rm -rf $@
@$(JSCOVERAGE) lib $@
test-coveralls:
@$(MAKE) test
@echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
@$(MAKE) test MOCHA_OPTS='--require blanket' REPORTER=mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js

.PHONY: test-cov test lib-cov install
test-all: test test-cov

.PHONY: install test test-cov test-all test-coveralls
4 changes: 1 addition & 3 deletions README.md
@@ -1,4 +1,4 @@
graceful [![Build Status](https://secure.travis-ci.org/fengmk2/graceful.png)](http://travis-ci.org/fengmk2/graceful)
graceful [![Build Status](https://secure.travis-ci.org/fengmk2/graceful.png)](http://travis-ci.org/fengmk2/graceful) [![Coverage Status](https://coveralls.io/repos/fengmk2/graceful/badge.png)](https://coveralls.io/r/fengmk2/graceful)
=======

![logo](https://raw.github.com/fengmk2/graceful/master/logo.png)
Expand All @@ -9,8 +9,6 @@ Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtExcept

[Node.js 异步异常的处理与domain模块解析](http://deadhorse.me/nodejs/2013/04/13/exception_and_domain.html)

* jscoverage: [xx%](http://fengmk2.github.com/coverage/graceful.html)

## Install

```bash
Expand Down
2 changes: 1 addition & 1 deletion example/connect_with_cluster/dispatch.js
Expand Up @@ -30,7 +30,7 @@ cluster.setupMaster({
// The important thing is that the master does very little,
// increasing our resilience to unexpected errors.

// cluster.fork();
cluster.fork();
cluster.fork();

cluster.on('disconnect', function (worker) {
Expand Down
9 changes: 7 additions & 2 deletions package.json
Expand Up @@ -4,15 +4,20 @@
"description": "Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.",
"main": "index.js",
"scripts": {
"test": "make test"
"test": "make test-all",
"blanket": { "pattern": "graceful/lib" },
"travis-cov": { "threshold": 98 }
},
"dependencies": {
},
"devDependencies": {
"connect": "*",
"should": "*",
"supertest": "*",
"jscover": "*",
"blanket": "*",
"travis-cov": "*",
"coveralls": "*",
"mocha-lcov-reporter": "*",
"mocha": "*"
},
"repository": {
Expand Down

0 comments on commit 87e47bb

Please sign in to comment.