From 4883e950ed03bff5923fcdd8e60441d001137905 Mon Sep 17 00:00:00 2001 From: dead_horse Date: Sun, 6 Jul 2014 00:49:11 +0800 Subject: [PATCH] add coverage --- .gitignore | 1 + .npmignore | 1 + .travis.yml | 3 ++- Makefile | 29 +++++++++++++++++++++++++---- package.json | 1 + 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b788561b3..4574ca26b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules test.js +coverage diff --git a/.npmignore b/.npmignore index a8a6f4c8c..6b67a8aad 100644 --- a/.npmignore +++ b/.npmignore @@ -3,3 +3,4 @@ benchmarks examples test Makefile +coverage diff --git a/.travis.yml b/.travis.yml index 5a7e991fc..b3cf7bccb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: node_js node_js: - "0.11" - +script: "make test-travis" +after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls" diff --git a/Makefile b/Makefile index 28529356e..07b105b4b 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,35 @@ SRC = lib/*.js include node_modules/make-lint/index.mk +TESTS = test/application \ + test/context/* \ + test/request/* \ + test/response/* + test: @NODE_ENV=test ./node_modules/.bin/mocha \ --require should \ --harmony-generators \ - test/application \ - test/context/* \ - test/request/* \ - test/response/* \ + $(TESTS) \ + --bail + +test-cov: + @NODE_ENV=test node --harmony-generators \ + node_modules/.bin/istanbul cover \ + ./node_modules/.bin/_mocha \ + -- -u exports \ + --require should \ + $(TESTS) \ + --bail + +test-travis: + @NODE_ENV=test node --harmony-generators \ + node_modules/.bin/istanbul cover \ + ./node_modules/.bin/_mocha \ + --report lcovonly \ + -- -u exports \ + --require should \ + $(TESTS) \ --bail bench: diff --git a/package.json b/package.json index f5670a071..4d667bc1e 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "should": "^3.1.0", "mocha": "^1.17.0", "supertest": "~0.13.0", + "istanbul-harmony": "~0.2.9", "make-lint": "^1.0.1" }, "engines": {