Phpunit is very slow when --coverage-html

I am using Phpunit. If I just run my tests with:

phpunit --log-junit output.xml

performed in a second. But if I want code coverage:

phpunit --coverage-html./report --log-junit output.xml

then it is very slow, phpunit sends "Configuration read from * .xml" and it freezes for a minute, then starts running tests

+4
source share
4 answers

phpunit , phpunit xdebug XDEBUG_CC_UNUSED XDEBUG_CC_DEAD_CODE, , . , , phpunit . phpunit ( ). , xdebug , , phpunit. . https://github.com/sebastianbergmann/php-code-coverage/pull/387

+3

. - , PHPunit , , , , :

node phpunit.xml,

<filter>
    <whitelist>
        <directory>../src</directory>
    </whitelist>
</filter>

addUncoveredFilesFromWhitelist false , , :

<filter>
   <whitelist addUncoveredFilesFromWhitelist="false">
        <directory suffix=".php">../src</directory>
        <exclude>
            <directory>../vendor</directory>
            <directory>../anotherpath</directory>
            <directory>../src/Modules/*/Fixture</directory>
            <file>../src/Modules/*/Bootstrap.php</file>
        </exclude>
    </whitelist>
</filter>

, "Fixture" Bootstrap.php

10 3 , :)

+3

.

, PHPUnit:

, , ( , ) , HTML, .

, .

+2

PHPUnit , PHPUnit .

, .

, PHPUnit, , / , addUncoveredFilesFromWhitelist false.

<phpunit>
    <!-- ... -->
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="false">
            <!-- ... -->
        </whitelist>
    </filter>
</phpunit>

, , , .

, PHPUnit addUncoveredFilesFromWhitelist is false , 5.5 true by .

+2

All Articles