[wp-trac] [WordPress Trac] #44240: Avoid running full PHPUnit test suite for every PHP file change

WordPress Trac noreply at wordpress.org
Sat May 26 21:58:11 UTC 2018


#44240: Avoid running full PHPUnit test suite for every PHP file change
------------------------------+-----------------------------
 Reporter:  jeremyfelt        |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:  needs-patch
  Focuses:                    |
------------------------------+-----------------------------
 In current trunk, when using `grunt watch` to ensure that changed PHP
 files are copied from `src/` to `build/`, the full PHPUnit test suite runs
 for every change. This takes somewhere around 4 minutes (on my local, non-
 VM config).

 In #42282, a `grunt watch:phpunit` was introduced. This makes it possible
 to run a specific set of tests whenever working with PHP files. To work,
 this requires specifying a group - `grunt watch:phpunit
 --group=testgroup`.

 That change, [42760], also added a `phpunit` grouping under the `_watch`
 config. At that time, a `grunt watch` command first fired `webpack:dev`.
 The `webpack:dev` task provided its own watch configuration through
 Webpack, and the core `_watch` command never fired. Whether intentional or
 not, the default PHPUnit suite did not run for every change.

 With [43309], which refactored the build process for core, the
 `webpack:dev` task was changed to `build`. The `_watch` task is no longer
 blocked from running, and the full PHPUnit test suite runs.

 If I remove the `phpunit` config from `_watch`, the current `grunt watch`
 takes 1-2 seconds rather than several minutes.

 I think the idea behind #42282 is still right, but with the requirement
 that PHP files are copied to `build/` before anything on the front end can
 be previewed, I don't think it should be mandatory.

 I'd like to see `grunt watch` not run any PHPUnit tests by default, since
 PHP files don't historically require a "build" for their changes to be
 previewed.

 It would be nice instead to see something like `grunt watch --phpunit
 --group=testgroup` for when you do want to run a select number of tests
 immediately on file change.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44240>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list