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

Add code coverage support using pcov #1132

Open
JesKingDev opened this issue Apr 19, 2024 · 2 comments
Open

Add code coverage support using pcov #1132

JesKingDev opened this issue Apr 19, 2024 · 2 comments

Comments

@JesKingDev
Copy link

Description
Generating code coverage with PHPUnit using xdebug.mode=coverage can be incredibly slow and uses a ton of memory (ex. over 8GB in our CI/CD pipelines). pcov is a more lightweight code coverage solution and is prioritized over xdebug by PHPUnit since version 7.0.9

While xdebug and pcov are not compatible, it's straightforward to pass the arguments to enable/disable when needed. Testing in my local environment showed a 75% decrease in both time and memory usage for integration tests.

Steps To Reproduce

  1. Enable xdebug with xdebug.mode=coverage
  2. Run make dev-test-run integration

Expected Result
Code coverage reports can be generated without significantly impacting speed or memory usage.

Actual Result
Running PHPUnit with code coverage results in high memory usage and slow performance - nearly 4 times slower/heavier for integration tests.

@YevhenZvieriev
Copy link
Contributor

Hi @JesKingDev

I completely agree that generating code coverage with PHPUnit using xdebug.mode=coverage can be extremely slow and resource-intensive, especially in CI/CD pipelines.

Can you give me more details about how it is implemented in your local development?

We can modify the bin/xdebug script or create a new bin/pcov script for example to enable/disable pcov.

Implementing pcov shouldn't be too difficult, and I'm happy to work on implementing the necessary changes to enable/disable the arguments as needed.

@markshust
Copy link
Owner

I don't have much experience with testing and Magento. Is it typical to run Xdebug when running integration tests? That doesn't seem right. I'd think it should always be disabled when tests are executed.

Perhaps you meant that with this line:

While xdebug and pcov are not compatible, it's straightforward to pass the arguments to enable/disable when needed.

...that the expected result is to disable Xdebug before the integration results are executed?

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

No branches or pull requests

3 participants