dogweather
Mix test --file-watch?
I love this Haskell Stack feature:
--file-watch Watch for changes in local files and automatically
rebuild. Ignores files in VCS boring/ignore file
I do stack test --file-watch and it continuously re-tests as I work. Has anyone configured anything similar for mix test? Maybe using Guard?
Marked As Solved
Also Liked
OvermindDL1
I use Cortex myself:
shanesveller
Hereās two language-agnostic options I have used in the past:
entr:
git ls-files **/*.ex* | entr -cdp mix test [--stale]
watchexec -c -p -e 'ex,exs,lock' -- mix test [--stale]
Hereās an Elixir-specific snippet from my dotfiles that Iām not sure of the provenance of, and that seems kind of overwrought, but I think it might have been derived from a JosĆ©/Plataformatec tweet or something?
fswatch --latency=0.01 --one-per-batch lib/ test/ | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()"
And a variant for umbrella apps:
fswatch --latency=0.01 --one-per-batch apps/ config/ mix.exs mix.lock | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()"
Edit: I wasnāt entirely mistaken, this was a JosĆ© gist that maybe got tweeted about: A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance Ā· GitHub
dogweather
Thanks! mix-test.watch works perfectly, including --stale support and clearing the screen before each test run.
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
- #javascript
- #code-sync
- #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









