Background
I have an umbrella project with several apps. One of its child applications needs to read a file before it starts. If it cannot find the file, it crashes.
This means that if I want to run mix test
, the child application has to find said file.
Problem
The problem here is that depending where I run mix test
, the command will either fail or succeed.
If I run mix test
inside the childβs application folder, the command will fail because the file it needs is not there.
If I runt he mix test
at the root of my umbrella app, then the command succeeds because it can find said file.
This means that I am cannot run mix test
while inside the child application folder, which is quite cumbersome. Sometimes I will open only that 1 application and do some changes there, other times I open the full umbrella project and make changes in multiple places.
Question
Is it possible to have mix test
work both at the root of the umbrella project and inside its child app ?
This is the folder structure I have:
ββββconfig
| ββββprod.exs
| ββββdev.exs
| ββββtest.exs
ββββassets
| ββββ products.json
ββββapps
β ββββmanager
| ββββ ...
β ββββstore
β β ββββlib
β β β ββββstore
β β ββββtest
β β ββββ...
I have the following in my config/test.exs
(root folder of umbrella project):
import Config
config :store,
products: "assets/products.json",
I guess I could simply duplicate the products.json
file everywhere in every app that needs to run a test using products, but I find this duplication rather unwise.
What is the preferred solution to this?