Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluded sources are being processed for mutation #1956

Open
IonBazan opened this issue Apr 26, 2024 · 0 comments
Open

Excluded sources are being processed for mutation #1956

IonBazan opened this issue Apr 26, 2024 · 0 comments

Comments

@IonBazan
Copy link

IonBazan commented Apr 26, 2024

Question Answer
Infection version 0.27.11
Test Framework version PHPUnit 9.6
PHP version 8.3.6
Platform e.g. Ubuntu and MacOS
Github Repo https://github.com/IonBazan/composer-diff

I am using Infection together with PHPUnit in my tool: https://github.com/IonBazan/composer-diff which targets PHP versions 5.3~8.4 so I'm conditionally aliasing some classes depending on PHP version as a polyfill for Symfony 7:
https://github.com/IonBazan/composer-diff/blob/d7f3cd5333c760d5bdfe0178571c99f52979bb9f/src/Command/DiffCommand.php#L15-L24

Since BaseNotTypedCommand remains uncovered when running under PHP 7+, I added it to excludes:
https://github.com/IonBazan/composer-diff/blob/d7f3cd5333c760d5bdfe0178571c99f52979bb9f/infection.json.dist#L2-L9

This used to work perfectly well as the file was completely ignored but recently (unfortunately I'm not able to check when) it started to fail, as the excluded file started to be processed by the mutant generator (tokenized) and crashed.

I temporarily solved it by passing --only-covered flag to avoid this file from being loaded but ideally, files mentioned in excluded should be omitted completely.

The last time it worked was on 29 Dec 2023, if that helps: IonBazan/composer-diff@005967f

Output after passing `--only-covered`
Infection - PHP Mutation Testing Framework version 0.27.11


Running initial test suite...

PHPUnit version: 9.6.15

  175 [============================] 5 secs

Generate mutants...

Processing source code files: 25/25
.: killed, M: escaped, U: uncovered, E: fatal error, X: syntax error, T: timed out, S: skipped, I: ignored

..................................................   ( 50 / 357)
..................................................   (100 / 357)
..................................................   (150 / 357)
..................................................   (200 / 357)
..................................................   (250 / 357)
..................................................   (300 / 357)
..................................................   (350 / 357)
.......                                              (357 / 357)

357 mutations were generated:
     357 mutants were killed
       0 mutants were configured to be ignored
       0 mutants were not covered by tests
       0 covered mutants were not detected
       0 errors were encountered
       0 syntax errors were encountered
       0 time outs were encountered
       0 mutants required more time than configured

Metrics:
         Mutation Score Indicator (MSI): 100%
         Mutation Code Coverage: 100%
         Covered Code MSI: 100%
Output with issue
Infection - PHP Mutation Testing Framework version 0.27.11


Running initial test suite...

PHPUnit version: 9.6.15

  174 [============================] 6 secs

Generate mutants...

Processing source code files: 21/26
Fatal error: Declaration of IonBazan\ComposerDiff\Command\BaseNotTypedCommand::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) must be compatible with Symfony\Component\Console\Command\Command::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): int in /Users/ionbazan/work/composer-diff/src/Command/BaseNotTypedCommand.php on line 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant