-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
39 lines (34 loc) · 896 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
const gulp = require('gulp');
const babel = require('gulp-babel');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const eslint = require('gulp-eslint');
gulp.task('build', ['lint'], () =>
gulp
.src('src/index.js')
.pipe(babel())
.pipe(gulp.dest('lib'))
);
gulp.task('test', ['build', 'pre-test'], () =>
gulp
.src('test/test.js', { read: false })
.pipe(mocha({ exit: true }))
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 100 } }))
);
gulp.task('lint', () => {
gulp
.src('src/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('default', () =>
gulp.watch(['src/**/*.js', 'test/**/*.js'], ['test'])
);
gulp.task('pre-test', () =>
gulp
.src(['lib/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire())
);