Hi what I trying to do is to make watcher task
with gulp
which will run my jasmine tests. What I have done so far:
var watch = require("gulp-watch");
var jasmine = require("gulp-jasmine");
gulp.task('tests.run.change-watcher', function (cb) {
gulp.src(testsFiles)
.pipe(watch(testsFiles))
.pipe(jasmine({ verbose: true }));
});
But when I run that task and try to change any file which meets the testsFiles
rules it doesn't show anything in console.
However when I run the next task:
gulp.task('tests.run', function (cb) {
gulp.src(testsFiles)
.pipe(jasmine({verbose:true}));
});
It works and shows next:
8 specs, 0 failures Finished in 0 seconds
Maybe I miss something?
To run only needed specs, try something like this:
This watcher uses two functions, one is for deriving the spec name based on the file name. In my case, it's:
The other function is
runJasmine
, which runs jasmine with a given test file.Just make everything fit to your setup and it should work. :-)