From 8d9cd406fb28e9cbccff058798ef6879273066f1 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 8 Jun 2018 04:40:18 +0000 Subject: [PATCH] Build/Test Tools: Avoid running full PHPUnit test suite for every PHP file change. Use `grunt watch --phpunit --group={testgroup}` to start `grunt watch` with a specific test group so that PHP file changes trigger a limited number of tests. Props jeremyfelt, birgire for testing. Fixes #44240. git-svn-id: https://develop.svn.wordpress.org/trunk@43335 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8afa3c7767..0dc8b7fa50 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1111,10 +1111,6 @@ module.exports = function(grunt) { '!tests/qunit/editor/**' ], tasks: ['qunit'] - }, - phpunit: { - files: [ '**/*.php' ], - tasks: [ 'phpunit:default' ] } } }); @@ -1160,6 +1156,13 @@ module.exports = function(grunt) { grunt.task.run( 'build' ); } + if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] || 'undefined' !== typeof grunt.option( 'phpunit' ) ) { + grunt.config.data._watch.phpunit = { + files: [ '**/*.php' ], + tasks: [ 'phpunit:default' ] + }; + } + grunt.task.run( '_' + this.nameArgs ); } );