diff --git a/Gruntfile.js b/Gruntfile.js index 65cd2bcc17..a43eabd832 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,7 +10,17 @@ module.exports = function(grunt) { SOURCE_DIR = 'src/', BUILD_DIR = 'build/', BANNER_TEXT = '/*! This file is auto-generated */', - autoprefixer = require( 'autoprefixer' ); + autoprefixer = require( 'autoprefixer' ), + phpUnitWatchGroup = grunt.option( 'group' ); + + if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) { + grunt.log.writeln(); + grunt.fail.fatal( + 'Missing required parameters. Example usage: ' + '\n\n' + + 'grunt watch:phpunit --group=community-events' + '\n' + + 'grunt watch:phpunit --group=multisite,mail' + ); + } // Load tasks. require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); @@ -742,6 +752,10 @@ module.exports = function(grunt) { '!tests/qunit/editor/**' ], tasks: ['qunit'] + }, + phpunit: { + files: [ '**/*.php' ], + tasks: [ 'phpunit:default' ] } } }); @@ -945,7 +959,7 @@ module.exports = function(grunt) { grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() { grunt.util.spawn({ cmd: this.data.cmd, - args: this.data.args, + args: phpUnitWatchGroup ? this.data.args.concat( [ '--group', phpUnitWatchGroup ] ) : this.data.args, opts: {stdio: 'inherit'} }, this.async()); });