From d37afa809b2d4e04e68ecef01c42074363ea68da Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sat, 18 Oct 2025 12:29:26 -0700 Subject: [PATCH] Conditionally pass Behat `--xdebug` flag --- bin/run-behat-tests | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/run-behat-tests b/bin/run-behat-tests index f9a09bc15..659a3d4ba 100755 --- a/bin/run-behat-tests +++ b/bin/run-behat-tests @@ -44,5 +44,10 @@ export WP_CLI_TESTS_ROOT # Generate the tags to apply environment-specific filters. BEHAT_TAGS=$(php "$WP_CLI_TESTS_ROOT"/utils/behat-tags.php) +BEHAT_EXTRA_ARGS=() +if [[ "${WP_CLI_TEST_COVERAGE}" == "true" ]] && vendor/bin/behat --help 2>/dev/null | grep -q 'xdebug'; then + BEHAT_EXTRA_ARGS+=('--xdebug') +fi + # Run the functional tests. -vendor/bin/behat --format progress "$BEHAT_TAGS" --strict "$@" +vendor/bin/behat --format progress "$BEHAT_TAGS" --strict "${BEHAT_EXTRA_ARGS[@]}" "$@"