Codeception4: GroupManager reports missing test file
Asked Answered
E

2

22

I upgraded Codeception to v4 (according to THIS) and then Symfony to v5 (according to THIS). Now, when I try to run tests I get an error about missing test file:

root@blabla: vendor/bin/codecept run

In GroupManager.php line 129:

GroupManager: File or directory /var/www/html/tests/unit/SomeFileCest.php does not exist

This file does NOT exist in current branch. It exists in another branch of the project, but current should not know anything about this file!

This problem happens no matter which branch I switch to. So somehow Codeception remembers, that one branch has additional test and demands that test in other branches. Looks like some sort of cache.

If I switch to the branch WITH the missing file, everything looks OK (I do get an error, but because of the old framework expected).

Error appears if I do vendor/bin/codecept run or vendor/bin/codecept run tests/functional for example (note that the missing test is a unit test).

I tried deleting /var and /vendor and running composer install/update. I also tried removing the branch completely and pulling from remote, but no joy.

Anybody has any idea why this would happen and how to fix this?

Explanation answered 6/1, 2020 at 9:58 Comment(1)
The file was referred to by some group configuration, most likely by tests/_support/failed.Anderaanderea
E
49

EDIT: After some simple testing it looks like it's related to old references in tests/_support/failed (as @Naktibalda mentioned in his/her comment).


I still don't fully understand what happened, but this can be fixed by running:

vendor/bin/codecept clean

From Codeception help:

clean Recursively cleans log and generated code

I will try to investigate further to understand why this happens, but for now this is what I have.

I hope this helps someone avoid the frustrations I went through ;)

Explanation answered 6/1, 2020 at 10:4 Comment(5)
Yup still works to solve the problem! Still no idea what the problem is. 8/2020 still get the issue latest versions, acceptance test, WordPress Codeception.Capital
Thanks for sharing this answer. I figured that there might be some kind of cache/generated code happening, but wasn't sure. Having such a quick win as finding this answer really helped me out!Interpolate
Worked, thank you! Is the path correct by the way? On linux I used ./vendor/bin/codeceptAthal
@Athal It depends on your setup and which directory you are running it from. In my case (docker container) I was in the main project directory, where vendor lives. But if you have different setup or run it not from main directory, then perhaps you need to adjust.Explanation
@Explanation I'm using a docker container, with php & composer, I run every command from the project root!Athal
T
0

For my case we were using paracept, to run stuff in parallel. This generated group files in /tests/_data

Once I removed the group files in this folder my test suite ran normally.

Worth noting that codecept clean doesn't clear this _data folder.

Tootsie answered 6/7, 2022 at 8:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.