Language agnostic tests feedback loop
Test-driven development might be dead or might not be. Whatever your approach to testing is – writing them first or after implementation – having quick feedback from your test is crucial for effective coding. I cannot imagine changing an existing method, function, class without the ability to see related specs output quickly.
There are multiple solutions specific to language or framework, e.g. guard for Ruby projects, which one of many features is running spec related to the changed class automatically in a separate terminal window.
Although you can find similar tools for other languages, I like using more straightforward tools (without configuration overhead) and more in the spirit of Unix tools philosophy. Moreover, using a language-agnostic tool have an obvious benefit of using it without the hustle and in the same way for whatever project in whatever language you are working at a moment.
I use entr for multiple tasks: reload a browser tab when CSS/JS/HTML files got changed, run specs suite when any
lib/ file got changed, recompile Rust project on file change.
Example usage with Elixir project is simple as:
ag -l | entr -s 'clear && mix test'
Now on each file change from files listed by
ag (silver searcher),
entr will execute defined command – clear screen and run
This way, you can assemble such command for any language of your choice and get an instant feedback loop from your tests.