infection: All mutants marked as not detected when using Composer files autoload option
| Question | Answer |
|---|---|
| Infection version | 0.25.1 |
| Test Framework version | PHPUnit 9.5.9 |
| PHP version | PHP 8.0.10 (cli) |
| Platform | MacOS |
| Github Repo | Repo |
Hi all, I have an issue with a new infection install. I’ve probably messed up with something as no mutant is killed. I’ve made a test that fails each time when we infection is running, but it doesn’t change anything. Truth to be told, if it changes something, I’ve made a local composer install.
Let me know if you need any other information.
Thank you for your help!
phpunit.xml
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
executionOrder="random"
resolveDependencies="true">
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit test">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
infection.json.dist
{
"$schema": "vendor/infection/infection/resources/schema.json",
"testFramework":"phpunit",
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "infection.log",
"summary": "summary.log",
"perMutator": "per-mutator.md"
},
"mutators": {
"@default": true
},
"phpUnit": {
"customPath": "./vendor/bin/phpunit"
},
"testFrameworkOptions": "",
"initialTestsPhpOptions": "-d xdebug.mode=coverage"
}
ExpenseReportTest.php
<?php
class ExpenseReportTest extends TestCase
{
public function testExpenseReport(): void {
if(getenv("INFECTION") === 1) {
$this->assertTrue(false);
}
}
}
Output with issue
./vendor/bin/infection --debug
____ ____ __ _
/ _/___ / __/__ _____/ /_(_)___ ____
/ // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
_/ // / / / __/ __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/ \___/\___/\__/_/\____/_/ /_/
Infection - PHP Mutation Testing Framework version 0.25.1@854bc7f4106252539ebfdf8f29fd4856e7d9ea4c
Running initial test suite...
PHPUnit version: 9.5.9
9 [============================] < 1 sec
PHPUnit 9.5.9 by Sebastian Bergmann and contributors.
Random Seed: 1631737940
. 1 / 1 (100%)
Time: 00:00.063, Memory: 14.00 MB
OK (1 test, 1 assertion)
Generating code coverage report in PHPUnit XML format ... done [00:00.008]
Generate mutants...
Processing source code files: 1/1
.: killed, M: escaped, U: uncovered, E: fatal error, X: syntax error, T: timed out, S: skipped
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM (41 / 41)
41 mutations were generated:
0 mutants were killed
0 mutants were not covered by tests
41 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): 0%
Mutation Code Coverage: 100%
Covered Code MSI: 0%
Please note that some mutants will inevitably be harmless (i.e. false positives).
Time: 2s. Memory: 18.00MB
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (11 by maintainers)
Right. #1482 tracks efforts to add this feature, but I don’t think this is going to be easy.