Last active
November 25, 2018 12:28
-
-
Save bicpi/5ae35a8d7f7538ef527c to your computer and use it in GitHub Desktop.
Run watcher for phpspec on file save with Gulp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not work anymore with Gulp4