-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGulpfile.js
executable file
·64 lines (49 loc) · 1.42 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
49
50
51
52
53
54
55
56
57
58
59
60
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
istanbul = require('gulp-istanbul'),
mocha = require('gulp-mocha'),
clean = require('gulp-clean');
gulp.task('clean', function () {
return gulp.src(['./build/**/*.js'])
.pipe(clean());
});
gulp.task('jshint', function () {
return gulp.src(['./src/**/*.js', './test/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('test', ['clean', 'jshint'], function () {
return gulp.src('./test/**/*.js')
.pipe(mocha());
});
gulp.task('pre-coverage', ['clean', 'jshint'], function () {
return gulp.src(['./src/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('coverage', ['pre-coverage'], function () {
return gulp.src('./test/**/*.js')
.pipe(mocha())
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({thresholds: {global: 70}}));
});
gulp.task('dist', ['coverage'], function () {
});
gulp.task('dev-jshint', function() {
return gulp.src(['./src/**/*.js', './test/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('dev-test', ['dev-jshint'], function () {
return gulp.src('./test/**/*.js')
.pipe(mocha())
.on('error', function (error) {
console.log(error);
this.emit('end');
});
});
gulp.task('dev', function () {
return gulp.watch(['./src/**/*.js', './test/**/*.js'], ['dev-test']);
});
gulp.task('ci', ['dist']);