-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathgulpfile.js
40 lines (32 loc) · 941 Bytes
/
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
'use strict';
const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
const paths = {
lint : ['./*.js', '!gulpfile.js'],
watch : ['gulpfile.js', './foreclosure.js', './test/**/*.js', '!test/{temp,temp/**}'],
tests : ['./test/**/*.js', '!test/{temp,temp/**}']
};
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task('lint', function(done) {
return gulp.src(paths.lint)
.pipe(plugins.eslint())
.pipe(plugins.eslint.format())
.pipe(plugins.eslint.failAfterError());
});
gulp.task('mocha', function() {
return gulp.src(paths.tests)
.pipe(plugins
.mocha({
reporter : 'spec',
bail : true
})
.on("error", handleError));
});
gulp.task('watch', function() {
gulp.watch(paths.watch, gulp.series('test'));
});
gulp.task('test', gulp.series('lint', 'mocha'));
gulp.task('default', gulp.series(gulp.parallel('test', 'watch')));