This package allows to run a custom command every time a file in the specified directories changes. It was initally written to auto-run unit tests every time a file gets saved.
The default invokation is very simple:
julia -e "using Watcher"
This will watch all
jl files in the current directory and in subdiretories, and run "julia test/runtests.jl" when a file changes.
You can change this behaviour:
julia -e "using Watcher" -- [-f=jl,txt] [-w=src,test] [--now] [--run echo "something changed"]
-f=type1,type2 specifies which file types to watch, default is
-w=dir1,dir2 tells it to look only in these two directors, default is the current directory and all its sub directories
--now will run the command already once on startup, and then continue watching for changes
--run is the command the will get executed, with the default being
It is recommended to put
println statements at the beginning and end of your unit test file, to get immediate feedback that the tests started running (executing
using statements can take some time):
println("Starting runtests.jl ...") using FactCheck, YourPackage # run your tests println(" ... finished runtests.jl") FactCheck.exitstatus()
7 months ago