The true "shared nothing" approach to processes in Erlang makes the task super difficult. I do not believe it will be possible to set up global system-wide mocks, and still be able to run the tests in parallel, without resorting to spawning multiple BEAM instances.
We could do, however, system-wide mocks that can be useful when you do
What I am currently working on is not even that, however. Instead, we plan to support mocks in concurrent tests where you explicitly grant access to processes you started with
MyMock |> allow(self(), other_pid) - that grants access to expectations and stubs defined by current process to some other process. This is already implemented on a branch, just doing some last tweaks.
Then we would have a mechanism to pass the mocks to Phoenix/Cowboy worker processes via HTTP header & a plug. But the mocks would still not be available in supervision tree started in appication callback module. So you can run concurrent tests with mocks, provided you do not need to mock anything there.