This repository was archived by the owner on Nov 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test coverage and gulp, instead of grunt.
- Loading branch information
Showing
5 changed files
with
72 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
coverage | ||
node_modules | ||
npm-debug.log | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'), | ||
jshint = require('gulp-jshint'), | ||
mocha = require('gulp-mocha'), | ||
istanbul = require('gulp-istanbul'), | ||
complexity = require('gulp-complexity'), | ||
runSequence = require('run-sequence'); | ||
|
||
function complexityTask() { | ||
return gulp.src(['lib/**/*.js', 'test/**/*.js']) | ||
.pipe(complexity({ | ||
halstead: 29, | ||
cyclomatic: 17 | ||
})); | ||
} | ||
|
||
function lintTask() { | ||
return gulp.src(['lib/**/*.js', 'test/**/*.js', 'bin/**/*.js']) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter('jshint-stylish')) | ||
.pipe(jshint.reporter('fail')); | ||
} | ||
|
||
function watchTask() { | ||
return gulp.watch('lib/**/*.js', ['lint', 'test']); | ||
} | ||
|
||
function defaultTask(done) { | ||
return runSequence('lint', 'test', done); | ||
} | ||
|
||
function coverTask() { | ||
return gulp.src(['lib/**/*.js']) | ||
.pipe(istanbul({includeUntested: true})) | ||
.pipe(istanbul.hookRequire()); | ||
} | ||
|
||
function coverageTask() { | ||
return gulp.src(['test/**/*.js', '!test/fixture/*.js']) | ||
.pipe(mocha()) | ||
.pipe(istanbul.writeReports()); | ||
} | ||
|
||
function reportTask() { | ||
require('open')('./coverage/lcov-report/index.html'); | ||
} | ||
|
||
function testTask(done) { | ||
// var queue = [lintTask, complexityTask, testUnitTask, coverTask, coverageTask]; | ||
// var test = new Promise(); | ||
|
||
return runSequence('lint', 'complexity', 'test-cover', 'test-coverage', done); | ||
} | ||
|
||
gulp.task('lint', lintTask); | ||
gulp.task('complexity', complexityTask); | ||
gulp.task('test-cover', coverTask); | ||
gulp.task('test-coverage', ['test-cover'], coverageTask); | ||
gulp.task('test', testTask); | ||
gulp.task('test-watch', watchTask); | ||
gulp.task('report', reportTask); | ||
gulp.task('default', defaultTask); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.