forked from inaturalist/inaturalistjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
29 lines (22 loc) · 843 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
const gulp = require( "gulp" );
const mocha = require( "gulp-mocha" );
const webpack = require( "webpack-stream" );
const webpackConfig = require( "./webpack.config.js" );
const webpackTask = ( ) => (
gulp.src( "./" )
.pipe( webpack( webpackConfig ) )
.pipe( gulp.dest( "build" ) )
);
const watchTask = ( ) => {
gulp.watch( ["lib/**/*.js"], webpackTask );
};
const mochaTask = ( ) => (
gulp.src( ["test/**/*.js"], { read: false } )
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe( mocha( { recursive: true, reporter: "nyan" } ) )
);
const watchMochaTask = ( ) => {
gulp.watch( ["lib/**/*.js", "./test/**/*.js"], mochaTask );
};
gulp.task( "test", gulp.series( webpackTask, mochaTask ) );
gulp.task( "default", gulp.series( webpackTask, gulp.parallel( watchTask, watchMochaTask ) ) );