forked from godong9/solr-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (31 loc) · 1.02 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
var gulp = require('gulp'),
istanbul = require('gulp-istanbul'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
mocha = require('gulp-mocha'),
jsdoc = require('gulp-jsdoc3');
gulp.task('lint', function() {
return gulp.src('./lib/**/*.js')
.pipe(jshint({}))
.pipe(jshint.reporter(stylish));
});
gulp.task('pre-test', function () {
return gulp.src(['./lib/**/*.js'])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});
gulp.task('test', gulp.series('pre-test', function() {
return gulp.src('./test/**/*.js', {read: false})
.pipe(mocha({reporter: 'nyan'}))
// Creating the reports after tests ran
.pipe(istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
}));
gulp.task('doc', function (cb) {
gulp.src(['./lib/**/*.js'], {read: false})
.pipe(jsdoc(cb));
});
gulp.task('default', gulp.series('lint', 'test', 'doc'));