diff --git Gruntfile.js Gruntfile.js
index e3b06c5a60..9f0b8edc52 100644
|
|
module.exports = function(grunt) { |
10 | 10 | SOURCE_DIR = 'src/', |
11 | 11 | BUILD_DIR = 'build/', |
12 | 12 | BANNER_TEXT = '/*! This file is auto-generated */', |
13 | | autoprefixer = require( 'autoprefixer' ); |
| 13 | autoprefixer = require( 'autoprefixer' ), |
| 14 | phpUnitWatchFiles = grunt.option( 'files' ) && SOURCE_DIR + grunt.option( 'files' ); |
| 15 | phpUnitWatchGroup = grunt.option( 'group' ); |
| 16 | |
| 17 | if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] ) { |
| 18 | if ( phpUnitWatchFiles && '.php' !== phpUnitWatchFiles.substring( phpUnitWatchFiles.length - 4 ) ) { |
| 19 | phpUnitWatchFiles += '/**/*.php'; |
| 20 | phpUnitWatchFiles = phpUnitWatchFiles.replace( '//', '/' ); |
| 21 | } |
| 22 | |
| 23 | if ( ! phpUnitWatchFiles || ! phpUnitWatchGroup ) { |
| 24 | grunt.log.writeln(); |
| 25 | grunt.fail.fatal( |
| 26 | 'Missing required parameters. Example usage: ' + "\n\n" + |
| 27 | 'grunt watch:phpunit --files=wp-admin/includes --group=community-events' |
| 28 | ); |
| 29 | } |
| 30 | } |
14 | 31 | |
15 | 32 | // Load tasks. |
16 | 33 | require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); |
… |
… |
module.exports = function(grunt) { |
742 | 759 | '!tests/qunit/editor/**' |
743 | 760 | ], |
744 | 761 | tasks: ['qunit'] |
| 762 | }, |
| 763 | phpunit: { |
| 764 | files: [ phpUnitWatchFiles ], |
| 765 | tasks: [ 'phpunit:default' ] |
745 | 766 | } |
746 | 767 | } |
747 | 768 | }); |
… |
… |
module.exports = function(grunt) { |
945 | 966 | grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() { |
946 | 967 | grunt.util.spawn({ |
947 | 968 | cmd: this.data.cmd, |
948 | | args: this.data.args, |
| 969 | args: phpUnitWatchGroup ? this.data.args.concat( [ '--group', phpUnitWatchGroup ] ) : this.data.args, |
949 | 970 | opts: {stdio: 'inherit'} |
950 | 971 | }, this.async()); |
951 | 972 | }); |