-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (37 loc) · 954 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
41
42
43
44
45
46
const gulp = require('gulp');
const plug = require('gulp-load-plugins')({
rename: {
'gulp-cached': 'cache',
},
});
let source = {
js: 'lib/*.js',
test: 'test/**.{js,json}',
};
gulp.task('default', [ 'test' ]);
gulp.task('test', [ 'eslint', 'mocha' ]);
gulp.task('coveralls', () =>
gulp.src('./coverage/lcov.info')
.pipe(plug.coveralls())
);
gulp.task('istanbul', () =>
gulp.src(source.js)
.pipe(plug.istanbul())
.pipe(plug.istanbul.hookRequire())
);
gulp.task('mocha', [ 'istanbul' ], () =>
gulp.src(source.test, { read: false })
.pipe(plug.mocha({ reporter: 'spec' }))
.pipe(plug.istanbul.writeReports())
);
gulp.task('eslint', () =>
gulp.src([ source.js, source.test ])
.pipe(plug.cache('lint'))
.pipe(plug.eslint())
.pipe(plug.remember('lint'))
.pipe(plug.eslint.format())
.pipe(plug.eslint.failAfterError())
);
gulp.task('watch', () => {
gulp.watch(source.js, [ 'eslint' ]);
});