From df698a24ba3d97da2dd0027f23db1fcfe5fc8816 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Thu, 28 Jan 2016 22:36:34 +0800 Subject: [PATCH] Update gulpfile - Build tests in `gulp build` - Watch test files - Clean test files as well --- gulpfile.babel.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 5fd6108..680f336 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -14,7 +14,7 @@ const PATHS = setUpPaths(); gulp.task('default', ['build']); gulp.task('build', callback => { - runSequence('clean', ['build-cli', 'build-app'], callback); + runSequence('clean', ['build-cli', 'build-app', 'build-tests'], callback); }); gulp.task('build-app', ['build-static'], () => { @@ -26,7 +26,9 @@ gulp.task('build-app', ['build-static'], () => { gulp.task('clean', callback => { del(PATHS.CLI_DEST).then(() => { del(PATHS.APP_DEST).then(() => { - callback(); + del(PATHS.TEST_DEST).then(() => { + callback(); + }); }); }); }); @@ -65,6 +67,9 @@ gulp.task('watch', ['build'], () => { gulp.watch(PATHS.CLI_SRC_JS, ['build-cli']) .on('error', handleError); + + gulp.watch(PATHS.TEST_SRC_JS, ['build-tests']) + .on('error', handleError); }); gulp.task('publish', done => { @@ -92,7 +97,7 @@ gulp.task('build-tests', done => { .pipe(gulp.dest(PATHS.TEST_DEST)); }); -gulp.task('test', ['build', 'build-tests'], () => { +gulp.task('test', ['build'], () => { return gulp.src(PATHS.TEST_DEST_JS, {read: false}) .pipe(mocha()); });