Runtime vs. compile time config for tests

I’m trying to set some config to be used only for testing. I am following instructions from here

If I add the specified lines to my test.exs

config :elixir_auth_google,
  client_id: "foo",
  client_secret: "bar",
  httpoison_mock: true

I get the following error when I run mix test

ERROR! the application :elixir_auth_google has a different value set for key :httpoison_mock during runtime compared to compile time. Since this application environment entry was marked as compile time, this difference can lead to different behaviour than expected:

  * Compile time value was not set
  * Runtime value was set to: true

But the app starts up fine. Have been pulling my hair out, have tried throwing this config in various other places to also set for compile time (config.exs is what I’d have expected to work) and nothing seems to make this go away.

Halp. What do?

Is your config.exs importing test.exs? The only files used automatically by Elixir are config.exs (compile time) and runtime.exs (startup time).

For better help, you should share your full config files.

1 Like

Just to check, have you tried the standard “turn it off and then on again” for compiled artifacts - rm -rf _build?

This seems to have solved my problem :see_no_evil: