Skip to content

Commit

Permalink
Adding code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Trevino committed Mar 14, 2015
1 parent 5596763 commit a36098d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: afj5zTj4nFspV825cOgUgvut0KiwvrC0G
35 changes: 33 additions & 2 deletions gulp.tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ var gulp = require('gulp'),
mocha = require('gulp-mocha'),
babel = require('gulp-babel'),
changed = require('gulp-changed'),
istanbul = require('gulp-istanbul'),
runSequence = require('run-sequence'),
coveralls = require('gulp-coveralls'),
isparta = require('isparta'),
MOCHA_REPORTER = 'nyan',
paths = {
source: 'src/**/*.js',
dest: 'lib/',
Expand Down Expand Up @@ -59,8 +63,22 @@ gulp.task('static-analysis', [
* Testing Tasks
*/
gulp.task('test', () => {
return gulp.src(paths.test)
.pipe(mocha({reporter: 'nyan'}));
return new Promise((resolve, reject) => {
gulp.src(paths.source)
.pipe(istanbul({
instrumenter: isparta.Instrumenter,
includeUntested: true
}))
.pipe(istanbul.hookRequire())
.on('finish', () => {
gulp.src(paths.test)
.pipe(mocha({reporter: MOCHA_REPORTER}))
.pipe(istanbul.writeReports({
reporters: ['lcov', 'text-summary']
}))
.on('end', resolve);
});
});
});

gulp.task('enableDebugging', () => {
Expand All @@ -69,6 +87,11 @@ gulp.task('enableDebugging', () => {
}
});

gulp.task('report-coverage', () => {
return gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
});

/**
* Meta/Control Tasks
*/
Expand All @@ -80,4 +103,12 @@ gulp.task('build', (cb) => {
cb
);
});

gulp.task('ci-build', (cb) => {
runSequence(
'build',
'report-coverage',
cb
)
});
gulp.task('default', ['build']);
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Express service discovery and mounting",
"main": "index.js",
"scripts": {
"test": "gulp"
"test": "gulp ci-build"
},
"repository": {
"type": "git",
Expand All @@ -31,9 +31,12 @@
"gulp-babel": "^4.0.0",
"gulp-changed": "^1.1.1",
"gulp-cli": "^0.1.5",
"gulp-coveralls": "^0.1.3",
"gulp-istanbul": "^0.6.0",
"gulp-jscs": "^1.4.0",
"gulp-jshint": "^1.9.2",
"gulp-mocha": "^2.0.0",
"isparta": "^2.2.0",
"run-sequence": "^1.0.2"
},
"homepage": "https://github.com/atsid/express-mountie",
Expand Down

0 comments on commit a36098d

Please sign in to comment.