Build/Test Tools: Add watch:phpunit
task.
This allow PHPUnit test groups to run automatically when files are changed, rather than having to be ran manually throughout the development process. This creates a smoother developer experience, and a tighter feedback loop. Props iandunn, netweb, pento Fixes #42282 git-svn-id: https://develop.svn.wordpress.org/trunk@42760 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c625e2e7d9
commit
2f68ec5750
18
Gruntfile.js
18
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());
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user