From 709539ad51ef009849fe13c681a85fe39fd8b8b9 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Tue, 17 Nov 2015 21:53:32 +0100 Subject: [PATCH] watch + test --- gulpfile.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index e07e68d..1ebf2da 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,7 @@ var filter = require('gulp-filter'); var rimraf = require('rimraf'); var path = require('path'); var es = require('event-stream'); +var cp = require('child_process'); var options = require('./tsconfig.json').compilerOptions; options.sourceMap = true; @@ -28,4 +29,12 @@ var compile = function () { gulp.task('clean', function (cb) { rimraf('out', cb); }); gulp.task('compile', ['clean'], compile); gulp.task('compile-only', compile); -gulp.task('watch', ['compile'], function () { gulp.watch(['src/**', 'typings/**'], ['compile-only']); }); + +gulp.task('test', function (cb) { + var child = cp.spawn('mocha', ['--reporter=dot'], { stdio: 'inherit' }); + child.on('exit', function (code) { cb(); }); +}); + +gulp.task('watch', ['compile', 'test'], function () { + gulp.watch(['src/**', 'typings/**'], ['compile-only', 'test']); +});