Open BackEndTea opened 6 years ago
Just came up to the exact same need.
I would like to have this option as well, to enable/disable the @covers
dynamically, depending on needs.
You can install tool rawr/covers-ignore
, which will remove @covers
and @coversNothing
annotations from a test suite, which you can then run in phpunit
.
Here's an example of usage in Github Actions: https://github.com/T-Regx/T-Regx/blob/master/.github/workflows/build.yaml#L70
I've written a script to match the changed lines in a git diff
with the covered lines in code coverage output, and run the tests that cover the changed lines.
I use @covers
everywhere, so unfortunately I'm only getting the tests that are written to test specifically those changed lines. It would be more effective if I could output a second codecoverage report which ignores the @covers
annotations and gives me the true picture of every test that tested each line.
I'll try #573
My script: BrianHenryIE/php-diff-test
Although the use of
@covers
and@coversNothing
is really useful for generating good coverage reports, there are also times when we want to ignore those settings. For example, i may wish to see exactly what my integration tests are covering.My proposal would be to add a command line flag to phpunit, for example
--ignore-covers
or something like that. Which would cause@covers
and@coversNothing
to be ignored when calculating the code coverage.Slightly related to: https://github.com/infection/infection/issues/88#issuecomment-351005953