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

For recent Xdebug coverage collection needs XDEBUG_MODE=coverage or xdebug.mode=coverage #1473

Closed
JesusValera opened this issue Jan 19, 2021 · 4 comments · Fixed by #1518
Closed

Comments

@JesusValera
Copy link

Question Answer
Infection version 0.20.2
Test Framework version PHPUnit 9.5.0
PHP version PHP 7.4.14 (cli) with Xdebug v3.0.2
Platform Docker (php:7.4-fpm)
Github Repo https://github.com/jenshaase/phel-lang
Output with issue

dev@php:/srv/phel-lang$ vendor/bin/infection

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

Infection - PHP Mutation Testing Framework version 0.20.2@6035c1566af6a5a8d833a276351e5e18ed412305


Running initial test suite...

PHPUnit version: 9.5.0

 614 [============================]  1 min

In CoverageChecker.php line 169:

 The code coverage generated by the initial test run is invalid. Please report the issue on the
 infection repository "https://github.com/infection/infection".

 $ '/srv/phel-lang/vendor/phpunit/phpunit/phpunit' '--configuration' '/srv/phel-lang/data/infection/infection/
 phpunitConfiguration.initial.infection.xml' '-vvv' '--coverage-xml=/srv/phel-lang/data/infection/infection/co
 verage-xml' '--log-junit=/srv/phel-lang/data/infection/infection/junit.xml'
 PHPUnit 9.5.0 by Sebastian Bergmann and contributors.

 Runtime:       PHP 7.4.14
 Configuration: /srv/phel-lang/data/infection/infection/phpunitConfiguration.initial.infection.xml
 Random Seed:   1611098728
 Warning:       XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

 ...............................................................  63 / 608 ( 10%)
 ............................................................... 126 / 608 ( 20%)
 ............................................................... 189 / 608 ( 31%)
 ............................................................... 252 / 608 ( 41%)
 ............................................................... 315 / 608 ( 51%)
 ............................................................... 378 / 608 ( 62%)
 ............................................................... 441 / 608 ( 72%)
 ............................................................... 504 / 608 ( 82%)
 ............................................................... 567 / 608 ( 93%)
 .........................................                       608 / 608 (100%)

 Time: 01:03.278, Memory: 28.00 MB

 OK (608 tests, 861 assertions)


 Issue(s):
 - The file "index.xml" could not be found: Could not find any "index.xml" file in "/srv/phel-lang/data/infection/infection"

I got the following error:

The file "index.xml" could not be found: Could not find any "index.xml" file in 
"/srv/phel-lang/data/infection/infection"

I have been trying to find this issue but the only one seems related is this one: #30
But it's too old and I think it's not exactly the same issue.

You can take a look at the project if you want, there you are everything.

Do you have any clue about this? 😄

@BackEndTea
Copy link
Member

Looking at the warning you get from phpunit:

Warning:       XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set

I think this may be xdebug 3.0 , and it hasn't been configured properly for generating coverage.

Do you get a coverage report when running the following command: vendor/bin/phpunit --coverage-text ?

@JesusValera
Copy link
Author

JesusValera commented Jan 21, 2021

I missed adding the flag XDEBUG_MODE=coverage when running vendor/bin/infection.

Thank you a lot @BackEndTea ! 🎉

EDIT: To make it clear. Just run in the terminal

XDEBUG_MODE=coverage ./vendor/bin/infection

@sanmai sanmai reopened this Jan 21, 2021
@sanmai sanmai changed the title The file "index.xml" could not be found: Could not find any "index.xml" For recent Xdebug coverage collection needs XDEBUG_MODE=coverage or xdebug.mode=coverage Jan 21, 2021
ricardoboss added a commit to elephox-dev/old-philly that referenced this issue Jan 24, 2021
@maks-rafalko
Copy link
Member

maks-rafalko commented Apr 26, 2021

Should be fixed in #1510

Released as 0.22.1

@sanmai
Copy link
Member

sanmai commented Apr 27, 2021

Is there a reason we can't inject XDEBUG_MODE before running PHPUnit?

If there's none, this is not resolved.

@sanmai sanmai reopened this Apr 27, 2021
sanmai added a commit to sanmai/infection that referenced this issue May 4, 2021
@sanmai sanmai added Feature Request and removed Bug labels May 4, 2021
sanmai added a commit that referenced this issue Nov 10, 2021
* Set XDEBUG_MODE for processes with coverage

Fixes #1473
@maks-rafalko maks-rafalko added this to the next milestone Nov 10, 2021
@maks-rafalko maks-rafalko modified the milestones: next, 0.26.0 Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants