Hey all,
I'd like to propose the complement to ExUnit.after_suite/1 which runs a set of callbacks immediately before the test suite starts.
We can set up code that's run before the test suite in test_helper.exs but, unlike ExUnit.after_suite/1, this code runs regardless of there being any actual tests to run as part of the suite. So if we need to tear down some code that was set up in test_helper.exs but no tests are run, we're out of luck.
Here's a particular example:
- Running an umbrella project with 2 apps
- mix test specific/file/in/app/1.ex
- Setup & tear-down happen correctly in app 1 suite
- Setup happens in app 2, but tear-down does not, because no files match the given path, and after_suite callbacks don't run.
Adding before_suite callbacks with the same semantics as after_suite would be helpful here, since setup would only happen if there were any tests to run.
Cheers,
João