Skip to content

Instantly share code, notes, and snippets.

@jfmercer
Forked from laracasts/Gulpfile.js
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfmercer/053e8d527753171c8aab to your computer and use it in GitHub Desktop.
Save jfmercer/053e8d527753171c8aab to your computer and use it in GitHub Desktop.
Automated PHPSpec tests with Gulp
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var run = require('gulp-run');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
gulp.task('test', function() {
gulp.src('spec/**/*.php')
.pipe(plumber())
.pipe(run('clear').exec())
.pipe(phpspec('', { notify: true }))
.on('error', notify.onError({
title: 'Dangit',
message: 'Your tests failed!'
// Optional notification fail icon
// icon: __dirname + '/fail.png'
}))
.pipe(notify({
title: 'Success',
message: 'All tests have returned green!'
// optional pass notification icon
// icon: __dirname + '/pass.png'
}));
});
gulp.task('watch', function() {
gulp.watch(['spec/**/*.php', 'src/**/*.php'], ['test']);
});
gulp.task('default', ['test', 'watch']);
{
"private": true,
"devDependencies": {
"gulp" : "~3.8",
"gulp-phpspec" : "~0.3",
"gulp-run" : "~1.6",
"gulp-notify" : "~2.2",
"gulp-plumber" : "~1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment