19

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?

callmebob
  • 6,128
  • 5
  • 29
  • 46

2 Answers2

46

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 ;)

callmebob
  • 6,128
  • 5
  • 29
  • 46
  • 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. – John Dee Aug 19 '20 at 16:36
  • 1
    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! – Matthew Setter Jan 15 '21 at 20:36
  • Worked, thank you! Is the path correct by the way? On linux I used `./vendor/bin/codecept` – funder7 Jan 14 '22 at 00:48
  • @funder7 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. – callmebob Jan 14 '22 at 06:01
  • @callmebob I'm using a docker container, with php & composer, I run every command from the project root! – funder7 Jan 14 '22 at 11:09
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.

David Yell
  • 11,756
  • 13
  • 61
  • 100