Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for configuring the MIX_ENV #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stocks29
Copy link

@stocks29 stocks29 commented Nov 12, 2022

Fixes #138

Allow the MIX_ENV tests run under to be specified in config

@jarlah
Copy link

jarlah commented Nov 16, 2023

isn't this same as

# mix.exs
def project do
  [
    ...
    preferred_cli_env: [
      "test.watch": :test
    ],
    ...
  ]
end

@stocks29
Copy link
Author

stocks29 commented Dec 1, 2023

It's been a while since I looked at this but from what I recall this line was the problem:

https://github.com/lpil/mix-test.watch/blob/master/lib/mix_test_watch/port_runner/port_runner.ex#L50

|> (fn command -> "MIX_ENV=test #{command}" end).()

It indiscriminately runs tests with MIX_ENV=test regardless of other configuration. While the mix test.watch CLI command will respect the preferred_cli_env, the subprocess which mix_test_watch kicks off ignores that configuration and always uses the test env.

Perhaps I'm missing something though? @jarlah @lpil are you able to run tests via mix_test_watch under custom environments with preferred_cli_env set as described above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support running in custom mix envs
2 participants