[wp-trac] [WordPress Trac] #57844: Tests/Script Loader: Run build step in PHP Unit test actions.

WordPress Trac noreply at wordpress.org
Fri Mar 3 20:21:59 UTC 2023


#57844: Tests/Script Loader: Run build step in PHP Unit test actions.
------------------------------+---------------------
 Reporter:  peterwilsoncc     |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  6.2
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch close   |     Focuses:
------------------------------+---------------------

Comment (by azaozz):

 Replying to [comment:12 SergeyBiryukov]:
 > #51734 had some good arguments for running PHPUnit tests from `src`
 instead of `build`
 > ...
 > I find it very helpful that the build step is currently not required for
 that, saves a lot of time :)

 Yep, I agree, PHPUnit testing in `/src` is faster and more convenient for
 developers. But it also has one big problem: testing from `/src` does not
 test the production (built) files in some cases. That makes it unreliable.

 So perhaps running PHPUnit tests from `/src` may be considered "developer
 convenience" but imho should not be considered acceptable for production
 testing of WordPress. I.e. tests that run after a commit should probably
 be testing the production files, not the "partial build" in /src.

 Thinking there should be an easy way to tell PHPUnit where to test from
 cli. Seems pretty easy to add couple more shortcuts to `package.json`.
 Then fix `grunt test` as currently it seems to be doing a lot of pointless
 stuff like running `grunt build` every time even when not needed and
 testing unchanged files, etc. Also perhaps stuff like `LOCAL_DIR="build"
 npm run env:start` can be documented better or automated.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57844#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list