[wp-trac] [WordPress Trac] #42282: Execute PHPUnit continuously over watched files in local environments
WordPress Trac
noreply at wordpress.org
Fri Oct 20 01:35:57 UTC 2017
#42282: Execute PHPUnit continuously over watched files in local environments
----------------------------------------+------------------------------
Reporter: iandunn | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch good-first-bug | Focuses:
----------------------------------------+------------------------------
Comment (by netweb):
Thanks for the ticket @iandunn, I've thought about this same feature
numerous times and I tend to walk away each time after I end up with an
unmaintainable list attempting to map `/src` files to the `/tests` that
cover those source files in `/tests`. It would be fantastic if we
''could'' do what is outlined in
[https://icyapril.com/php/programming/2017/05/14/whats-changed-only-
running-phpunit-tests-for-changed-classes.html this] post but
unfortuanately WPs codbase isn't this orginized, yet ;)
Having a default watch task to run the entire PHP test suite I don't think
is practicle for a ''watch'' task because of the time taken to finish a
complete PHPUnit test run (~4 minutes on my mid 2014 Mac Book Pro here
locally) as saving the same PHP file again once the Grunt job has spawned
will try to fire off another watch task instance resulting in multiple
PHPUnit task runs queued up that you'd need to hit CTRL-C to escape this.
I think we could add some ''watch'' tasks for specific components, e.g.
`grunt watch:multisite` to watch the PHPUnit `multisite` group to then run
`grunt phpunit:multisite` and a few more specific commonly developed
PHPUNit groups such as `formatting`, `feed`, `ajax`, `hooks`, `query`,
`post` to name a few from `phpunit --list-groups`, and per your patch
`community-events` where each ''group'' would correspond with a Grunt task
e.g `grunt watch:community-events` that executes `phpunit --group
community-events`.
I've added an example of this in [attachment:42282.2.diff], and we'd
expand this by pairs of ''watch'' and ''phpunit'' Grunt tasks for each
PHPUnit group that we chose to add, thinking about this further there's
quite possibly a way to do this dynamically where any passed in ''PHPUnit
group'' name would spawn the appropriate PHPUnit group task which would be
much cleaner than adding numerous named instances.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42282#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list