1

I have a project A, which depends on a dependency B created by me also...

when I want to launch test on A with a simple mix test, it's getting the dependecy B, compiling it and starting it in :prod environnement...

Which mean A is in :test environnement and B is in :prod env.

I would like for the tests to launch the dependency in :dev environnement (or anything else but :prod), is there a way to do that ?

TheSquad
  • 7,385
  • 8
  • 40
  • 79
  • Although it looks an overkill here, one might introduce [their own compiler](http://elixir-lang.org/blog/2012/04/24/a-peek-inside-elixir-s-parallel-compiler/) and delegate compilation of `B` project in the requested environment to it. That way the project `B` in local would always have been compiled in the same environment as `A` currently is. – Aleksei Matiushkin Apr 04 '17 at 13:52

1 Answers1

1

Maybe your MIX_ENV is prod and mix test doesn't change it to test. Try explicitly:

MIX_ENV=test mix test

and for dev

MIX_ENV=dev mix test
PatNowak
  • 5,721
  • 1
  • 25
  • 31
  • Actually, the issue is not here, I do not have MIX_ENV env variable set. However you pointed me out to my mistakes that Mix.env was used a compile time not running time. – TheSquad Apr 04 '17 at 13:01
  • Unfortunately I can't accept the answer as it is... edit it so you point the difference between compile time Mix.env (in :prod) and running time Mix.env, and I will :-) – TheSquad Apr 04 '17 at 13:33
  • “I do not have MIX_ENV env variable set”—you always do. If you have not set it explicitly, `mix` has done it for you. – Aleksei Matiushkin Apr 04 '17 at 13:44
  • @mudasobwa: what I meant is I didn't ```export MIX_ENV=prod```... of course that mix does it for you, but I don't overcharge it... – TheSquad Apr 04 '17 at 13:56