diff --git Gruntfile.js Gruntfile.js
index e3b06c5a60..3e97237e06 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 | } |
| 21 | |
| 22 | if ( ! phpUnitWatchFiles || ! phpUnitWatchGroup ) { |
| 23 | grunt.log.writeln(); |
| 24 | grunt.fail.fatal( |
| 25 | 'Missing required parameters. Example usage: ' + "\n\n" + |
| 26 | 'grunt watch:phpunit --files=wp-admin/includes --group=community-events' |
| 27 | ); |
| 28 | } |
| 29 | } |
14 | 30 | |
15 | 31 | // Load tasks. |
16 | 32 | require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); |
… |
… |
module.exports = function(grunt) { |
742 | 758 | '!tests/qunit/editor/**' |
743 | 759 | ], |
744 | 760 | tasks: ['qunit'] |
| 761 | }, |
| 762 | phpunit: { |
| 763 | files: [ phpUnitWatchFiles ], |
| 764 | tasks: [ 'phpunit:default' ] |
745 | 765 | } |
746 | 766 | } |
747 | 767 | }); |
… |
… |
module.exports = function(grunt) { |
945 | 965 | grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() { |
946 | 966 | grunt.util.spawn({ |
947 | 967 | cmd: this.data.cmd, |
948 | | args: this.data.args, |
| 968 | args: phpUnitWatchGroup ? this.data.args.concat( [ '--group', phpUnitWatchGroup ] ) : this.data.args, |
949 | 969 | opts: {stdio: 'inherit'} |
950 | 970 | }, this.async()); |
951 | 971 | }); |