On my current project we are trying to keep our dependencies between apps in our umbrella explicit. We’ve run into situations where we get different results if we run mix test from the top umbrella level vs. running it in each individual apps’ directory. These have mostly been because some dependency was not explicit, but at the top umbrella level all the sub-apps’ modules are available when the task runs.
I’m trying to add aliases to the top level mix.exs file but I keep getting an error that the task could not be found. That implies there is some special case logic around mix tasks at the umbrella level. Can someone explain that or point me somewhere to learn about it?
Big picture, we’d like our CI server to run tests in each individual app directory so we can find out when those implied dependencies creep in. I could do it with a shell script, but I thought an alias at the umbrella level would be cleaner. I’m open to other approaches.
As far as I remember, mix test in the umbrella does run the sub tests in random order but in the same instance of the BEAMVM. Applications started for earlier tests won’t be shut down in-between, this may cause issues.
If you want to test the sub apps isolated to make sure that there aren’t any hidden deps, you need to iterate the sub apps with a shell script, but should be easy:
for app in apps/*; do
pushd $app
mix test
pops
done