-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
48 lines (40 loc) · 1.27 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
39
40
41
42
43
44
45
46
47
48
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var jsdoc = require('gulp-jsdoc3');
var subtree = require('gulp-subtree');
var del = require('del');
var vinylPaths = require('vinyl-paths');
gulp.task('test', function(){
return gulp
.src(['test/*.js'], {read: false})
.pipe(mocha());
});
gulp.task('watch', function(){
var watcher = gulp.watch(['lib/**', 'test/**'], ['test']);
watcher.on('change', function(event){
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
gulp.task('coverage', function(){
return gulp.src(['test/*.js'], {read: false})
.pipe(cover.instrument({
pattern: ['index.js', 'lib/**.js'],
debugDirectory: 'debug'
}))
.pipe(mocha())
.pipe(cover.gather())
.pipe(cover.format())
.pipe(gulp.dest('reports'));
});
gulp.task('clean-docs', function(){
return gulp.src(['docs/'])
.pipe(vinylPaths(del));
});
gulp.task('make-docs', function(cb){
return gulp.src(['index.js', 'lib/**/*.js', 'README.md'], {read: false})
.pipe(jsdoc('./docs'));
});
gulp.task('docs', ['clean-docs', 'make-docs']);
gulp.task('default', ['test', 'watch']);