env_file path for docker-compose extend relative to base file

I have a two docker-compose files, one is ./libbeat/docker-compose.yml and one in ./testing/environments/base.yml

The file in libbeat has the following config inside:

  env_file:
    - build/test.env

When I now run docker-compose -f ../testing/environments/base.yml -f docker-compose.yml build inside the libbeat folder, I get the following error:

ERROR: Couldn't find env file: .../testing/environments/build/test.env

This is true as the test.env file is in libbeat/build/test.env.

It seems like the env_file path is relative to the base.yml file instead of the docker-compose.yml file. I would expect it to be relative to the file from where it picked the config. There is no env_file configuration in base.yml

The same problem applies to the build path in case the two docker-compose files are in a different directory. All paths are relative to the first compose file defined in the chain. Is that expected?