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 ?

1
  • Although it looks an overkill here, one might introduce their own 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. Commented Apr 4, 2017 at 13:52

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

4 Comments

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.
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 :-)
“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.
@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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.