Codeception4: GroupManager reports missing test file

  codeception, php, symfony, symfony5

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:

[email protected]: 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?

Source: Symfony Questions