I am attempting to get gulp working to help automate some unit testing. I have the following gulp file.
var gulp = require('gulp'),
mocha = require('gulp-mocha');
gulp.task('unit', function() {
return gulp.src('test/unit/**/*.js')
.pipe(mocha({ reporter: 'spec' }))
.on('error', handleError);
});
gulp.task('watch', function() {
gulp.watch(['src/**/*.js', 'test/unit/**/*.js'], ['unit']);
});
gulp.task('test', ['unit', 'watch']);
When I run 'gulp unit', the tests run fine.
When I run 'gulp test', the tests run, and it appears that 'watch' is working. If I make a change to one of the test files, the tests rerun correctly, taking into account the changes I made in the test file.
If I make changes to my source files, the tests also re-run, but they DO NOT run against the updated version of the source file.
My thought is that somehow, the source file is being cached, but I cannot find any others who seem to have had this issue or find a solution.
Thanks for helping this Gulp/Node/Mocha newbie!