johnkary / phpunit-speedtrap

Reports on slow-running tests in your PHPUnit test suite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable in coverage test

Theremsoe opened this issue · comments

Hi John.

Is possible disable speedtrap when phpunit retrive the coverage flag?

Thanks!

Hi Julio, There is currently no way to disable SpeedTrap at runtime. If the listener is enabled in phpunit.xml the slowness report will be output.

However, I think in the future this should change. In a future version we should instead make the slowness report an opt-in option, similar to --coverage flags. For example, a user should provide the runtime option --speedtrap or set a PHP environment variable to enable the report. I have proposed this feature in #63 and tagged it for the next major version of PHPUnit SpeedTrap.

Thank you for the idea!

@Theremsoe Hi Julio, I have opened PR #66 to address your use case. This new PR allows disabling SpeedTrap profiling and reporting by setting an environment variable PHPUNIT_SPEEDTRAP="disabled"

Using the proposed feature you could generate code coverage and disable SpeedTrap like this:

$ PHPUNIT_SPEEDTRAP="disabled" ./vendor/bin/phpunit --coverage-html ./coverage

If PR #66 is merged and released, would this feature work for you when generating code coverage?

Thank you for the great idea!

So many thanks Jonh. I will clone the PR for check i it in local.