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

Checking fail if config not in root directory (testFramework=codeception) #1876

Open
Sufir opened this issue Sep 26, 2023 · 0 comments
Open

Comments

@Sufir
Copy link

Sufir commented Sep 26, 2023

Question Answer
Infection version 0.27.0
Test Framework version Codeception 5.0.11
PHP version 8.2.10
Platform Debian GNU/Linux 12

Bug if configs placed not in root directory.

image

If you specify directories relative to the root, then codeception fails with The "/var/www/app/tools/./src" directory does not exist.

> /var/www/app/vendor/bin/codecept run -c tools/codeception.yml --no-colors --fail-fast --coverage-phpunit codeception-coverage-xml --xml /var/www/app/var/infection/infection/junit.xml -o 'paths: output: /var/www/app/tools/../var/infection/infection' -o 'coverage: enabled: true' -o 'coverage: include: [./src/*.php,./tests/*.php]' -o 'settings: shuffle: true'
Codeception PHP Testing Framework v5.0.11 https://helpukrainewin.org
[Seed] 332620295

In Finder.php line 640:

  The "/var/www/app/tools/./src" directory does not exist.

It works if i set pathes like that: -o 'coverage: include: [../src/*.php,../tests/*.php]'. But infection fails in both variants:

infection.json5
{
 "$schema": "https://raw.githubusercontent.com/infection/infection/0.27.0/resources/schema.json",
 "source": {
     "directories": [
         "src",  // or ../src - infection fails
         "tests"  // or ../tests - infection fails
     ]
 },
 "phpUnit": {
     "configDir": "../tools"
 },
 "logs": {
     "text": "../var/infection"
 },
 "mutators": {
     "@default": true
 },
 "timeout": 30,
 "tmpDir": "../var/infection",
 "testFramework": "codeception",
 "testFrameworkOptions": "-c tools/codeception.yml"
}

codeception.yml
namespace: Tests
support_namespace: Support
paths:
   tests: ../tests
   output: ../tests/_output
   data: ../tests/Support/Data
   support: ../tests/Support
   envs: ../tests/_envs
actor_suffix: Tester
extensions:
   enabled:
       - Codeception\Extension\RunFailed
Output with issue
> infection --configuration=tools/infection.json5 --debug -vvv

Box Requirements Checker
========================

> Using PHP 8.2.10
> PHP is using the following php.ini file:
 WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
 ✔ The application requires the version "^8.1" or greater.
 ✔ The application requires the extension "zlib".
 ✔ The application requires the extension "dom".
 ✔ The application requires the extension "json".
 ✔ The package "colinodell/json5" requires the extension "json".
 ✔ The application requires the extension "libxml".
 ✔ The package "nikic/php-parser" requires the extension "tokenizer".


[OK] Your system is ready to run the application.


[debug] Checking INFECTION_ALLOW_XDEBUG
[debug] The Xdebug extension is loaded (3.2.2) xdebug.mode=coverage
[debug] Process restarting (INFECTION_ALLOW_XDEBUG=internal|3.2.2|1|*|*)
[debug] Running /usr/local/bin/php /usr/local/bin/infection --debug -vvv

Box Requirements Checker
========================

> Using PHP 8.2.10
> PHP is using the following php.ini file:
 /tmp/MRaXor

> Checking Box requirements:
 ✔ The application requires the version "^8.1" or greater.
 ✔ The application requires the extension "zlib".
 ✔ The application requires the extension "dom".
 ✔ The application requires the extension "json".
 ✔ The package "colinodell/json5" requires the extension "json".
 ✔ The application requires the extension "libxml".
 ✔ The package "nikic/php-parser" requires the extension "tokenizer".


[OK] Your system is ready to run the application.


[debug] Checking INFECTION_ALLOW_XDEBUG
[debug] Restarted (438 ms). The Xdebug extension is not loaded

   ____      ____          __  _
  /  _/___  / __/__  _____/ /_(_)___  ____
  / // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
_/ // / / / __/  __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/  \___/\___/\__/_/\____/_/ /_/

#StandWithUkraine

Infection - PHP Mutation Testing Framework version 0.27.0


Running initial test suite...

codeception version: 5.0.11

   3 [============================] 2 secs
Codeception PHP Testing Framework v5.0.11 https://helpukrainewin.org
[Seed] 900094819


[ERROR] Project tests must be in a passing state before running Infection.
        Check the executed command to identify the problem: '/var/www/app/vendor/bin/codecept' 'run' '-c'
        'tools/codeception.yml' '--no-colors' '--fail-fast' '--coverage-phpunit' 'codeception-coverage-xml' '--xml'
        '/var/www/app/var/infection/infection/junit.xml' '-o' 'paths: output: /var/www/app/./var/infection/infection'
        '-o' 'coverage: enabled: true' '-o' 'coverage: include: [src/*.php,tests/*.php]' '-o' 'settings: shuffle: true'
        codeception reported an exit code of 143.
        Refer to the codeception's output below:
        STDOUT:
        Codeception PHP Testing Framework v5.0.11 https://helpukrainewin.org
        [Seed] 900094819

        STDERR:




[debug] Restarted process exited 1
Passed tests
> /var/www/app/vendor/bin/codecept run -c tools/codeception.yml --no-colors --fail-fast --coverage-phpunit codeception-coverage-xml --xml /var/www/app/var/infection/infection/junit.xml -o 'paths: output: /var/www/app/tools/../var/infection/infection' -o 'coverage: enabled: true' -o 'coverage: include: [../src/*.php,../tests/*.php]' -o 'settings: shuffle: true'
Codeception PHP Testing Framework v5.0.11 https://helpukrainewin.org
[Seed] 1271455587

Tests.Unit Tests (1) ---------------------------------------------------------------------------------------------------------------------------
✔ ExampleTest: Some feature(0.65s)
------------------------------------------------------------------------------------------------------------------------------------------------


Code Coverage Report:
  2023-09-26 13:51:21

 Summary:
  Classes: 50.00% (1/2)
  Methods:  1.44% (2/139)
  Lines:    1.44% (2/139)

Tests\Unit\ExampleTest
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
Remote CodeCoverage reports are not printed to console

PHPUnit report generated in codeception-coverage-xml
Time: 00:15.884, Memory: 24.00 MB

OK (1 test, 1 assertion)
- JUNIT XML report generated in file:///var/www/app/var/infection/infection/junit.xml
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