You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a Yii2 module that is designed for applications with both frontend and backend components, requiring separate test configurations. To simplify configuration management, I created a base configuration file, codeception.base.yml, which contains common settings such as database, Yii2 modules, and paths. Then, I extended this base configuration in two separate codeception.yml files for the frontend and backend.
However, I noticed that when I define the params: - .env in the base configuration file, Codeception ignores it during test execution. The .env file is not loaded, which causes the tests to fail. If I explicitly define the params: - .env in each extended configuration file, then everything works as expected.
What do you get instead?
The tests fail to run correctly because the environment variables from .env are not being loaded from the base configuration file. If i run with debug-d enabled there is not call to any params loader.
extends: ../codeception.base.yml# i also set here the custom config file for yii2 modulepaths:
tests: frontend/testsoutput: frontend/tests/_outputsupport: frontend/tests/_supportenvs: frontend/tests/_envs
backend/codeception.yml:
extends: ../codeception.base.yml# i also set here the custom config file for yii2 modulepaths:
tests: backend/testsoutput: backend/tests/_outputsupport: backend/tests/_supportenvs: backend/tests/_envs
When params: - .env is only defined in codeception.base.yml, it is ignored. But if I add it to each codeception.yml like this, the tests run successfully:
params:
- .env
Details
Codeception version: 4.2.2
PHP Version: php8.1
Operating System: MacOs
Installation type: Composer
List of installed packages: (skipped since is huge: +100)
The text was updated successfully, but these errors were encountered:
@Eseperio Is the "extends" keyword documented somewhere?
Internally, Codeception uses symfony/yaml to parse yaml config files. I'm not sure if "extends" is something which is supported by the current parsing logic.
What are you trying to achieve?
I am developing a Yii2 module that is designed for applications with both frontend and backend components, requiring separate test configurations. To simplify configuration management, I created a base configuration file,
codeception.base.yml
, which contains common settings such as database, Yii2 modules, and paths. Then, I extended this base configuration in two separatecodeception.yml
files for the frontend and backend.However, I noticed that when I define the
params: - .env
in the base configuration file, Codeception ignores it during test execution. The.env
file is not loaded, which causes the tests to fail. If I explicitly define theparams: - .env
in each extended configuration file, then everything works as expected.What do you get instead?
The tests fail to run correctly because the environment variables from
.env
are not being loaded from the base configuration file. If i run with debug-d
enabled there is not call to any params loader.Code Example
Here is an example of my setup:
codeception.base.yml
:frontend/codeception.yml
:backend/codeception.yml
:When
params: - .env
is only defined incodeception.base.yml
, it is ignored. But if I add it to eachcodeception.yml
like this, the tests run successfully:Details
The text was updated successfully, but these errors were encountered: