Skip to content

Commit

Permalink
Adding istanbul for code coverage testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
hellojwilde committed Nov 16, 2014
1 parent 815ede6 commit 6069c74
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ node_modules

# Compiled directory contents
lib
coverage

# The devil.
.DS_Store
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src
.travis.yml
example
example
coverage
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ node_js:
- "0.10"
before_install:
- npm install -g gulp
after_script:
- istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
after_script:
- gulp submit-coverage
17 changes: 15 additions & 2 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var jstransform = require('gulp-jstransform');
var regenerator = require('gulp-regenerator');
var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
var instanbul = require('gulp-istanbul');
var coveralls = require('gulp-coveralls');

gulp.task('build-js', function() {
return gulp.src('src/**/*.js')
Expand All @@ -20,8 +22,19 @@ gulp.task('build-proto', function() {
gulp.task('build', ['build-js', 'build-proto']);

gulp.task('test', ['build'], function(done) {
return gulp.src('lib/**/__tests__/*.js', {read: false})
.pipe(mocha({reporter: 'spec'}));
gulp.src(['lib/**/*.js', '!lib/**/*-test.js'])
.pipe(instanbul())
.on('finish', function() {
gulp.src('lib/**/__tests__/*.js', {read: false})
.pipe(mocha({reporter: 'spec'}))
.pipe(instanbul.writeReports())
.on('end', done);
});
});

gulp.task('submit-coverage', function() {
gulp.src('coverage/lcov.info')
.pipe(coveralls());
});

gulp.task('watch', function() {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"expect": "^0.1.1",
"fakeredis": "^0.2.1",
"gulp": "^3.8.10",
"gulp-blanket-mocha": "0.0.4",
"gulp-coveralls": "^0.1.3",
"gulp-istanbul": "^0.3.1",
"gulp-jstransform": "hellojwilde/gulp-jstransform",
"gulp-mocha": "^1.1.1",
"gulp-regenerator": "^2.0.0",
Expand Down

0 comments on commit 6069c74

Please sign in to comment.