sebastianbergmann / php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.
BSD 3-Clause "New" or "Revised" License
8.82k stars 374 forks source link

Feature Request: Ignore @covers option #571

Open BackEndTea opened 6 years ago

BackEndTea commented 6 years ago

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

fkupper commented 6 years ago

Just came up to the exact same need.

danon commented 2 years ago

I would like to have this option as well, to enable/disable the @covers dynamically, depending on needs.

danon commented 2 years ago

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

BrianHenryIE commented 1 year ago

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