mix-test.watch icon indicating copy to clipboard operation
mix-test.watch copied to clipboard

Ability to pass different args and use different environments for different tasks

Open doughsay opened this issue 7 years ago • 4 comments

This would be great and a lot more flexible:

# config/config.exs
use Mix.Config

if Mix.env == :dev do
  config :mix_test_watch,
    tasks: [
      {"test", args: "--stale"},
      {"dialyzer", mix_env: "dev"}
    ]
end

As noted in https://github.com/lpil/mix-test.watch/issues/56, the dialyzer task fails if passed unknown args. Also, the default env to run the task in is "dev" (I don't know if this matters much though).

The above API seems to make a lot of sense though and would offer a lot of flexibility.

doughsay avatar Sep 08 '17 20:09 doughsay

Hello, I concur this - I run credo before my tests and I would love to specify some arguments to it while use --stale with tests as well.

stefanjarina avatar Sep 19 '17 19:09 stefanjarina

Hi, I'm running in to the same issue when use with credo, and keep getting error.

Unknown switch: --stale

be able to specify which task would be awesome!

yuchunc avatar Sep 27 '17 15:09 yuchunc

This seems to work for me:

# config/config.exs

use Mix.Config

if Mix.env == :dev do
  config :mix_test_watch,
    tasks: [
      "test --stale",
      "credo -a --strict",
    ]
end

phikes avatar May 17 '18 14:05 phikes

The ability to run tasks under separate envs would be really nice. I have e2e tests which run in an :e2e environment. I'm unable to run them with this module because I cannot override the env.

stocks29 avatar Nov 12 '22 01:11 stocks29