johnkary / phpunit-speedtrap

Reports on slow-running tests in your PHPUnit test suite
MIT License
783 stars 62 forks source link

Disable in coverage test #62

Closed Theremsoe closed 3 years ago

Theremsoe commented 5 years ago

Hi John.

Is possible disable speedtrap when phpunit retrive the coverage flag?

Thanks!

johnkary commented 5 years ago

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!

johnkary commented 4 years ago

@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!

Theremsoe commented 4 years ago

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