Skip to content

Instantly share code, notes, and snippets.

@ivarvong
Forked from josevalim/watcher.sh
Created July 14, 2016 15:22
Show Gist options
  • Save ivarvong/5400307451ba16696f11bcaa8f83cde9 to your computer and use it in GitHub Desktop.
Save ivarvong/5400307451ba16696f11bcaa8f83cde9 to your computer and use it in GitHub Desktop.
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment