Switch to Istanbul for code coverage. Add coverage to CI via coveralls.

This commit is contained in:
Stefan Thomas
2014-05-17 09:59:20 +02:00
parent 8979a3cf02
commit 7901e12b0a
5 changed files with 12 additions and 19 deletions

1
.gitignore vendored
View File

@@ -42,3 +42,4 @@ test/config.js
/lib-cov
/src-cov
/coverage.html
/coverage

View File

@@ -4,3 +4,6 @@ node_js:
notifications:
email:
false
script: npm test --coverage
after_success:
- npm run coveralls

View File

@@ -1,16 +0,0 @@
all:
./node_modules/.bin/gulp
test:
mocha --reporter spec test/*-test.js
coverage:
rm -rf src-cov
mkdir src-cov
mkdir src-cov/js
jscoverage --no-highlight src/js/ripple src-cov/js/ripple
RIPPLE_LIB_COV=1 mocha --reporter html-cov test/*-test.js > coverage.html
rm -rf src-cov
.PHONY: test coverage all

View File

@@ -1,5 +1,7 @@
#The Ripple JavaScript Library
[![Build Status](https://travis-ci.org/ripple/ripple-lib.svg?branch=develop)](https://travis-ci.org/ripple/ripple-lib) [![Coverage Status](https://coveralls.io/repos/ripple/ripple-lib/badge.png?branch=develop)](https://coveralls.io/r/ripple/ripple-lib?branch=develop)
[![NPM](https://nodei.co/npm/ripple-lib.png)](https://www.npmjs.org/package/ripple-lib)
`ripple-lib` connects to the Ripple network via the WebSocket protocol and runs in Node.js as well as in the browser.
@@ -92,4 +94,4 @@ See [The `ripple-lib` Guides](docs/GUIDES.md) and [The `ripple-lib` API Referenc
**Generating code coverage**
ripple-lib uses `jscoverage` to generate code coverage. To generate a file `coverage.html`, run `make coverage`
ripple-lib uses `istanbul` to generate code coverage. To create a code coverage report, run `npm test --coverage`. The report will be created in `coverage/lcov-report/`.

View File

@@ -26,11 +26,14 @@
"gulp-concat": "~2.2.0",
"gulp-jshint": "~1.5.5",
"webpack": "~1.1.10",
"map-stream": "~0.1.0"
"map-stream": "~0.1.0",
"istanbul": "~0.2.10",
"coveralls": "~2.10.0"
},
"scripts": {
"pretest": "node_modules/.bin/gulp concat-sjcl",
"test": "mocha --reporter spec test/*-test.js"
"test": "./node_modules/.bin/istanbul test -x build/sjcl.js -x src/js/jsbn/* ./node_modules/.bin/_mocha -- --reporter spec test/*-test.js",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
},
"repository": {
"type": "git",