Not the same behaviour at all, although `Application.compile_env/2` would probably do what I want at the expense of adding a test config.
The examples that I gave are quite similar to the code we’re running. We’re using an umbrella where we have a main "web" app and then a bunch of other "web" apps (called something else, of course). For test purposes, an endpoint must be defined and should be started in `start/2` callback. Therefore, we’re doing:
```elixir
@endpoint if(Mix.env() == :test, do: MySubAppWeb.Endpoint)
```
(We’ve actually switched to option 3 in my original message, but the point is the same.)
We literally want this to be `nil` every time we are running this except under test. (We’re also filtering the `children` for `Supervisor.start_link/2`, so `nil` isn’t an issue.)