Helper for uncaching node modules to allow run tests within the same process as gulp tasks
npm install uncache-modules
var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var uncacheModules = require('uncache-modules');
var testServer;
gulp.task('run-test-server', function(cb) {
if (testServer) {
testServer.close();
uncacheModules('./src');
}
testServer = require('./src/app');
testServer.on('listening', cb);
});
gulp.task('run-tests', ['run-test-server'], function(cb) {
return gulp.src('test.js')
.pipe(jasmine({ verbose: false }));
});
gulp.task('watch', function() {
gulp.start('run-tests');
gulp.watch(['test.js','src/**/*.js'], ['run-tests']);
})
npm install -g gulp
gulp test