UNPKG

655 BJavaScriptView Raw
1import gulp from 'gulp';
2import babel from 'gulp-babel';
3import replace from 'gulp-replace';
4import mocha from 'gulp-mocha';
5
6const files = {
7 src : 'src/**/*.js',
8 test: 'test/**/*.js',
9};
10
11gulp.task('watch', () => {
12 return gulp.watch(files.src, ['babel']);
13});
14
15gulp.task('babel', () => {
16 return gulp.src(files.src)
17 .pipe(babel())
18 .pipe(replace(/\n{2,}/g, '\n'))
19 .pipe(gulp.dest('lib'))
20 .on('end', () => {
21 gulp.start('mocha');
22 });
23});
24
25gulp.task('mocha', () => {
26 return gulp.src(files.test, { read: false })
27 .pipe(babel())
28 .pipe(mocha({ reporter: 'tap' }))
29});
30
31gulp.task('default', [
32 'watch',
33 'babel',
34]);