Skip to content

Instantly share code, notes, and snippets.

@bicpi
Last active November 25, 2018 12:28
Show Gist options
  • Save bicpi/5ae35a8d7f7538ef527c to your computer and use it in GitHub Desktop.
Save bicpi/5ae35a8d7f7538ef527c to your computer and use it in GitHub Desktop.
Run watcher for phpspec on file save with Gulp
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var notify = require('gulp-notify');
gulp.task('test', function() {
var options = { verbose: 'v', notify: true, clear: true, formatter: 'pretty' };
gulp.src('spec/**/*.php')
.pipe(phpspec('./bin/phpspec run', options))
.on('error', notify.onError({
title: 'Crap',
message: 'Your tests failed!',
icon: __dirname + '/node_modules/gulp-phpspec/assets/test-fail.jpeg'
}))
.pipe(notify({
title: 'Success',
message: 'All tests have returned green!',
icon: __dirname + '/node_modules/gulp-phpspec/assets/test-pass.jpeg'
}));
});
gulp.task('watch', function() {
gulp.watch(['spec/**/*.php', 'src/**/*.php'], ['test']);
});
gulp.task('default', ['test', 'watch']);
@iwasherefirst2
Copy link

This does not work anymore with Gulp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment