Is it possible to run mix test for only one application in an umbrella?

From the root of the umbrella application I would like to run mix test but have it only load and run code from a single application, but I have been unable to figure out how. I know that I can cd apps/specific_app; mix test I believe that approach will be less scalable. The reason I want to do this is so that when I am in my editor and running the tests for a specific file, I do not want the output the attempts to run the same test file in all of the other applications.

You can run specific tests with
mix test path/to/file:line_number
I am not sure if this is what you are looking for.


No, that’s not quite what I’m looking for since Mox will still try to run the tests for that path against all umbrella projects.

1 Like

@axelson, just did something for you


Wow, thanks that looks super handy!

You can use the --app in mix cmd: mix cmd --app app1 --app app2 mix test


@josevalim thanks!

Is that documented anywhere? I’m not able to find it in mix --help, mix help, or man mix.

Nevermind, I found it. Need to look under mix help cmd since that is the command that you’re actually running.

But a downside to running the tests via mix cmd is that the paths may be different, since the working directory is different. Is that correct? (I’ve run into some odd errors where mix test from inside an application directory works fine, but mix test from the umbrella project root does not).

Maybe with the shell? This is a bash version that test all apps, from their respective roots.

$ for i in apps/*; do if [ -d "$i" ]; then cd "$i" && mix test && cd ../../; fi; done

If You want to be more selective… You can modify the glob pattern apps/*.

It’s not glamour, but it should be working.

1 Like

Coming back to this thread rather late :sweat_smile: but I ran into the same issue today and came across my post in a search.

While this is very useful it still runs the test in that applications directory whereas I want the same behavior of mix test when run from the umbrella root which loads the entire project, this is needed in my umbrella application because the configuration is shared for every app in the umbrella, and the configuration references modules from various applications which causes tests to fail if run from that applications folder.

Since this relies on cding into each application folder it suffers from the same issue.