Running tests in umbrella app

I have a seed file and i added it inside one of the apps mix file and it should always run before the tests. It works well from root.

                   test: [       
                          "run apps/app_name/priv/repo/seeds.exs",
                          "test"
                         ]

But if i wanted to run test from individual app it throws error because the path is now changed to this:

                  test: [       
                          "run priv/repo/seeds.exs",
                          "test"
                        ]

Is there any way i can make it work from inside the app and also from root.

I tried defining it in the root mix file but doesn’t seem to work.

1 Like

Perhaps Application.app_dir/1 or 2 could be used?

https://hexdocs.pm/elixir/Application.html#app_dir/1

Thanks for your reply. I just moved the seeds task into a separate command like this:

 "seeds": [
    "run priv/repo/seeds.exs"      
   ]
1 Like