[proposal] exunit with umbrella child apps changes

16 views
Skip to first unread message

Daniel Kukula

unread,
Oct 19, 2023, 8:34:20 AM10/19/23
to elixir-lang-core
Hi all, I have 2 proposals when running exunit inside umbrella:

1) Automatically add `/test` at the end of path running tests in umbrella:
`mix test apps/child_app`
currently this does not run tests, but it also does not print any warnings about not tests found - I have to specify the test folder in the child app:
`mix test apps/child_app/test` 
but I don't have to do this when running tests in standard app - this just works:
`mix test`

2) Add umbrella app name as a tag so this works and runs only tests in child app
`mix test --include child_app`
`mix test --exclude child_app`
This may be backwards incompatible for some of us so maybe
`include_app`, `exclude_app` modifiers make sense ?

Jon Rowe

unread,
Oct 21, 2023, 6:19:30 AM10/21/23
to Elixir Lang Core
For 1) this behaviour is actually the same as non umbrella apps, if you run `mix test` you will run the default test path in both both cases (for an umbrella this runs all apps tests). If you do `mix test some_path` in a normal app it will similarly misbehave (in my phoenix app `mix test .`  for example tries to run tests from node_modules 😂)

For 2) are you aware of `mix cmd?` you can filter that to apps with `mix do —app app cmd` so you can test specific apps with: `mix do —app app1 —app app2 cmd mix test` 

I actually run `mix cmd mix test` on umbrella apps quite regularly because unlike `mix test` it runs the tests in each app seperately which can be helpful to isolate dependency issues.

Hope that helps
Cheers
Jon
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.

Daniel Kukula

unread,
Oct 21, 2023, 7:45:43 AM10/21/23
to elixir-lang-core
Thanks Jon. It's helpful. My main concern with adding the tags was to exclude single app from tests.
When I'm changing something in one of the childs and everything is finally green in this one I wan't to run tests for all the rest to check if nothing depends on my changes. (it takes few minutes to run all the tests in this particular app and I ran the tests just a minute ago)

Jon Rowe

unread,
Oct 21, 2023, 7:59:40 AM10/21/23
to Elixir Lang Core
Ah another improvement for excluding could be  an `—except` option for `mix do` then you could exclude apps that way
Reply all
Reply to author
Forward
0 new messages