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

Both global-ignore and global-ignoreSourceCodeByRegex cannot be set in infection.json file at the same time #1433

Closed
lapisangularis opened this issue Nov 20, 2020 · 1 comment
Labels

Comments

@lapisangularis
Copy link
Contributor

lapisangularis commented Nov 20, 2020

Question Answer
Infection version 0.20.1
Test Framework version PHPUnit 8.5.9
PHP version 7.4.11
Platform Linux 6a8c54c6eabc 4.14.116-boot2docker
Playground https://infection-php.dev/r/7l7

When setting up both global-ignoreSourceCodeByRegex and global-ignore settings in infection.json.dist file, the second one in order is producing The profile or mutator "global-ignoreSourceCodeByRegex||global-ignore" was not recognized. error.

I believe the problem is that there is a break statement in MutatorResolver, so the second option is not unset from config, and then treated as a profile or mutator.

phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
        backupStaticAttributes="false"
        bootstrap="vendor/autoload.php"
        colors="true"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"
        convertWarningsToExceptions="true"
        processIsolation="false"
        stopOnFailure="false">
   <testsuites>
       <testsuite name="Unit">
           <directory suffix="Test.php">./tests/Unit</directory>
       </testsuite>

       <testsuite name="Integration">
           <directory suffix="Test.php">./tests/Integration</directory>
       </testsuite>

       <testsuite name="Feature">
           <directory suffix="Test.php">./tests/Feature</directory>
       </testsuite>
   </testsuites>
   <filter>
       <whitelist processUncoveredFilesFromWhitelist="true">
           <directory suffix=".php">./src</directory>
           <exclude>
               <directory suffix="routes.php">./src</directory>
           </exclude>
       </whitelist>
   </filter>
</phpunit>
Output with issue
bash-5.0$ vendor/bin/infection

In MutatorResolver.php line 113:

 The profile or mutator "global-ignoreSourceCodeByRegex" was not recognized.


run [--test-framework TEST-FRAMEWORK] [--test-framework-options TEST-FRAMEWORK-OPTIONS] [-j|--threads THREADS] [--only-covered] [-s|--show-mutations] [--no-progress] [--force-progress] [-c|--configuration CONFIGURATION] [--coverage COVERAGE] [--mutators MUTATORS] [--filter FILTER] [--formatter FORMATTER] [--git-diff-filter GIT-DIFF-FILTER] [--git-diff-base GIT-DIFF-BASE] [--logger-github] [--min-msi MIN-MSI] [--min-covered-msi MIN-COVERED-MSI] [--log-verbosity LOG-VERBOSITY] [--initial-tests-php-options INITIAL-TESTS-PHP-OPTIONS] [--skip-initial-tests] [--ignore-msi-with-no-mutations] [--debug] [--dry-run]
@maks-rafalko
Copy link
Member

Released: https://github.com/infection/infection/releases/tag/0.20.2

PHAR will be uploaded soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants