Infection: problem with tmpDir on Windows

Created on 15 Aug 2020  路  8Comments  路  Source: infection/infection

| Question | Answer
| ------------| ---------------
| Infection version |phar 0.16.4
| Test Framework version | Codeception 4.1.1
| PHP version | 7.4.5
| Platform | Windows

Probably there is a problem with windows directory delimiters.

scenario 1 - no tmpDir specified

php.exe c:\bin\phptools\infection.phar run --test-framework=codeception

produces error

In Configuration.php line 568:                                                                                                                                                                                                                                                                                                                                                                                                                                             
Path for output is not writable. Please, set appropriate access mode for output path: D:\projects\test\C:/Users/zdene/AppData/Local/Temp/infection\ 

Target folder C:/Users/zdene/AppData/Local/Temp/infection\ is created.

scenario 2 - tmpDir with absolute path
add "tmpDir": "D:/projects/test/" in infection.json.dist
gives error

... Please, set appropriate access mode for output path: D:\projects\test\D:/projects/test/infection\  

scenario 3 - tmpDir with relative path
add "tmpDir": "tmp" in infection.json.dist gives error

... Please, set appropriate access mode for output path: D:\projects\test\D:/projects/test/tmp/infection\  

Target folder infection exists and is writable.

Bug Help Wanted

All 8 comments

Hello, thanks for reporting an issue. Unfortunately, I don't have windows machine and won't be able to debug it in the near future, so any help is appreciated here.

I've done some initial investigation here and found that infection generates command like:

php E:\www\project\vendor\codeception\codeception\codecept run --no-colors --fail-fast --coverage-phpunit codeception-coverage-xml --xml "C:/Users/username/AppData/Local/Temp/infection/junit.xml" -o "paths: output: C:/Users/username/AppData/Local/Temp/infection" -o "coverage: enabled: true" -o "coverage: include: [models/*.php]" -o "settings: shuffle: true" -vvv

At first glance infection part looks good to me.

But codeception does weird concatenation in case the first symbol of the path does not contain / in the:
https://github.com/Codeception/Codeception/blob/4.1/src/Codeception/Configuration.php#L554-L557

Spoke with guys from codeception in their slack channel. They raised PR to fix this issue https://github.com/Codeception/Codeception/pull/5966

Just FYI: It won't be possible to backport this fix to codeception 3.x. I assume we need to update conflicts section once fix is released

I assume we need to update conflicts section once fix is released

but in this case, all users on macos/linux won't be able to use Codeception 3.x with Infection, while it perfectly works (from what I understand)

Probably, it's better to throw an exception for Windows users, or somehow add requirements to composer.json to require non-windows machine :) (similar to https://getcomposer.org/doc/01-basic-usage.md#platform-packages, but I didn't find anything like this)

@maks-rafalko we may bump up codeception version for the current master and throw an exception for 0.17 for example. I can't find another way how to solve this issue.

https://github.com/Codeception/Codeception/pull/5966 has been merged to 4.1. Waiting for release

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maks-rafalko picture maks-rafalko  路  4Comments

bcremer picture bcremer  路  5Comments

olivernybroe picture olivernybroe  路  5Comments

GaryJones picture GaryJones  路  4Comments

terabytesoftw picture terabytesoftw  路  3Comments