Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2153784
commit 2389539
Showing
1 changed file
with
20 additions
and
17 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,33 +1,36 @@ | ||
'use strict'; | ||
|
||
var stylish = require('jshint-stylish'); | ||
var istanbul = require('gulp-istanbul'); | ||
var jshint = require('gulp-jshint'); | ||
var mocha = require('gulp-mocha'); | ||
var gulp = require('gulp'); | ||
|
||
var lint = ['index.js', 'lib/*.js']; | ||
|
||
gulp.task('lint', function() { | ||
return gulp.src(lint) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter(stylish)); | ||
}); | ||
var mocha = require('gulp-mocha'); | ||
var istanbul = require('gulp-istanbul'); | ||
var eslint = require('gulp-eslint'); | ||
var unused = require('gulp-unused'); | ||
|
||
gulp.task('coverage', function() { | ||
return gulp.src(lint) | ||
.pipe(istanbul()) | ||
return gulp.src(['index.js', 'lib/**/*.js']) | ||
.pipe(istanbul({includeUntested: true})) | ||
.pipe(istanbul.hookRequire()); | ||
}); | ||
|
||
gulp.task('test', ['coverage'], function() { | ||
gulp.task('mocha', ['coverage'], function() { | ||
return gulp.src('test/*.js') | ||
.pipe(mocha({reporter: 'spec'})) | ||
.pipe(istanbul.writeReports()) | ||
.pipe(istanbul.writeReports({ | ||
reporters: [ 'text', 'text-summary' ], | ||
reportOpts: {dir: 'coverage', file: 'summary.txt'} | ||
})) | ||
})); | ||
}); | ||
|
||
gulp.task('eslint', function() { | ||
return gulp.src(['*.js', 'lib/**/*.js', 'test/*.js']) | ||
.pipe(eslint()); | ||
}); | ||
|
||
gulp.task('unused', function() { | ||
var utils = require('./lib/utils'); | ||
return gulp.src(['index.js', 'lib/**/*.js']) | ||
.pipe(unused({keys: Object.keys(utils)})); | ||
}); | ||
|
||
gulp.task('default', ['lint', 'test']); | ||
gulp.task('default', ['mocha', 'eslint']); |