Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use other code coverage driver than xdebug

I want to use pcov instead of xdebug for code coverage generation.

I'm using Docker and I have xdebug installed.

Can I be sure that xdebug won't affect test execution if I run the following command?

php -d xdebug.default_enable=0 -d pcov.enabled=1 path/to/phpunit --coverage-text

I read that pcov might be faster but as I understood xdebug has to be disabled.

Is it better do the following to achieve the fastest coverage instead of running the above command?

  1. remove/truncate xdebug config
  2. run tests

    php -d pcov.enabled=1 path/to/phpunit --coverage-text
    
  3. restore xdebug config

like image 591
Tarasovych Avatar asked Dec 22 '22 21:12

Tarasovych


1 Answers

Xdebug and PCOV both overload the same parts of the engine, as a result they are incompatible, and there's no sense in the authors trying to make them compatible.

Xdebug must not be loaded if you want to use PCOV as the driver for php-code-coverage.

Source: I wrote pcov ...

like image 150
Joe Watkins Avatar answered Jan 05 '23 16:01

Joe Watkins