A related concept: you may have noticed that when you run mix test, it assumes MIX_ENV=test, but most tasks assume MIX_ENV=dev unless otherwise specified.
To set the default environment for a Miix task (eg, a task to run JS tests) or task alias, you can use :preferred_cli_env. For example:
defmodule MyProject.Mixfile do
use Mix.Project
def project do
[
# ...
aliases: aliases(),
preferred_cli_env: [
# note that all task names are atoms
test: :test,
jstest: :test,
"test.all": :test
]
]
end
# ...
defp aliases do
[
"test.all": ["test", "jstest"]
]
end
end






















