Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Xdebug from phpunit and other images #89

Closed
kasparsd opened this issue Oct 12, 2022 · 3 comments
Closed

Missing Xdebug from phpunit and other images #89

kasparsd opened this issue Oct 12, 2022 · 3 comments

Comments

@kasparsd
Copy link

It is currently impossible to generate code coverage reports using the phpunit or any other images containing PHP that are generated by this repository.

@wordpress/env attempts to enable Xdebug support here:

https://github.com/WordPress/gutenberg/blob/d5915916abc45e6682f4bdb70888aa41e98aa395/packages/env/lib/init-config.js#L84-L90

but it doesn't do it for images that could actually be used for running CLI tasks such as phpunit, tests, cli and others as reported here WordPress/gutenberg#42286

@kasparsd
Copy link
Author

Could we update all images to install Xdebug but leave it disabled by default? Or install and enable Xdebug only for php-cli usage so that it doesn't impact the performance of non-CLI requests?

@desrosj
Copy link
Contributor

desrosj commented Nov 14, 2022

Hey @kasparsd,

xDebug is currently installed and disabled by default. WordPress Core actually generates a code coverage report using them and submits it to Codecov.io.

To boot the Docker containers with xDebug, a few environment variables need be set:

  • LOCAL_PHP_XDEBUG needs to be set to true.
  • To configure xDebug to generate coverage reports, LOCAL_PHP_XDEBUG_MODE needs to be set to coverage (develop,debug is the default).

Could you give this a try, or confirm that you've tried this and are experiencing issues?

@kasparsd
Copy link
Author

Thanks! I'm not sure how I missed the LOCAL_PHP_XDEBUG conditional in common.sh:

# If LOCAL_PHP_XDEBUG=true xdebug extension will be enabled
if [ "$LOCAL_PHP_XDEBUG" = true ]; then
docker-php-ext-enable xdebug
rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
else
docker-php-ext-enable opcache
rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
fi

So we just need to update wp-env to set these environment variables whenever xdebug is being requested via the custom CLI param WordPress/gutenberg#42286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants