-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
gulpfile.js
38 lines (32 loc) · 1.04 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var eslint = require('gulp-eslint');
var unused = require('gulp-unused');
gulp.task('coverage', ['eslint'], function() {
return gulp.src(['index.js', 'lib/**/*.js'])
.pipe(istanbul({includeUntested: true}))
.pipe(istanbul.hookRequire());
});
gulp.task('mocha', ['coverage'], function() {
return gulp.src('test/{integration/,}*.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())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
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', ['mocha']);