wp-cli / wp-cli-tests

WP-CLI testing framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve run-behat-tests for custom setups

swissspidy opened this issue · comments

Feature Request

Describe your use case and the problem you are facing

This package recommends using run-behat-tests for running the Behat tests, which works fine for off-the-shelf WP-CLI command packages, but not for custom projects.

The script bails early if there's no features folder and it does not detect any custom behat.yml file in the project root.

That's why projects like the AMP plugin or Traduttore resort to using vendor/bin/behat directly:

https://github.com/ampproject/amp-wp/blob/d2d441cf6f1f4e9a7268a9c6e3360be309852a2c/.github/workflows/build-test-measure.yml#L703-L706
https://github.com/ampproject/amp-wp/blob/d2d441cf6f1f4e9a7268a9c6e3360be309852a2c/.github/workflows/build-test-measure.yml#L703-L706

Describe the solution you'd like

I think the run-behat-tests script (and potentially others, haven't checked) should first check for existence of behat.yml. If it exists, it should not bail early if there's no features folder and not set BEHAT_PARAMS and the like.

This are just some ideas off the top of my head, I haven't actually tried to implement it this way yet, so perhaps it doesn't even work. But I just wanted to write it down :-)