Fl4m3Ph03n1x
Create an alias for another task in mix.exs?
Background
So I am using this library mix-test.watch from @lpil which I really like.
Usually I just run mix test.watch and I let the process running.
As a bonus to this library, you can also execute it by passing the --only flag. For example, if I want to watch only my “super_duper_tests” I can do it like this: mix text.watch --only super_duper_tests and this will only watch all the tests that have, for example, the @moduletag :super_duper_tests on them.
Enter Alias
So, this is all fun, but I am lazy and I don’t like typing. So I want to create an alias like this:
mix test.watch.super_duper that will be translated to mix text.watch --only super_duper_tests.
To achieve this I tried the following on my mix.exs file:
defp aliases do
[
"test.watch.super_duper": ["test.watch --only super_duper_tests"]
]
end
Problem
You may have guessed, since I am posting here, that this is not working. When I try my new alias, I get the error message Could not find test.watch task.
So obviously I am doing something wrong in the configuration.
Questions
How can I create an alias for mix test.watch?
Marked As Solved
Also Liked
hauleth
BTW I prefer to use entr or watchman with mix test --listen-on-stdin
stefanchrobot
I personally use watchexec:
watchexec -e 'ex,exs,eex,leex' -- 'mix format && mix test --stale'
LostKobrakai
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









