How to disable code coverage for phpunit 5.4+

In older versions of phpunit, you can disable the flag --no-coverage report: --no-coverage . This allowed our package to run much faster in CI environments, etc. In the current stable version (5.4), I do not see this option in the documents . What is the current way to disable code coverage?

+5
source share
1 answer

The --no-coverage may not be in the documentation, but it works for me.

It is still in PHPUnit code, see Command.php: 66 and Command.php :. 523


I created a tiny test project with 1 class and 1 test to try it out. I have included code coverage output (HTML) in the <logging> section of the phpunit.xml file.

Running phpunit without an option:

 $ phpunit PHPUnit 5.4.6 by Sebastian Bergmann and contributors. [removed irrelevant output] OK (1 test, 1 assertion) Generating code coverage report in HTML format ... done 

Code coverage is created and displayed.

Running phpunit with the option:

 $ phpunit --no-coverage PHPUnit 5.4.6 by Sebastian Bergmann and contributors. [removed irrelevant output] OK (1 test, 1 assertion) 

Lack of code generation. (The command also ran faster.)

0
source

All Articles