March 30, 2018

SBT run/test for every edit automatically

What is it about?

Imagine you have to do huge number of smaller edits to your source code in scala and verify the output. Most of the time, in other languages especially, you end up doing lots of manual work that consumes lots of repeated boring time.

So, we end up taking some time to automate them - change -> build -> compile -> run. Which is smartly handled in scala.

Ok, tell me about the savior

~ (Tilde) is our savior. 

Run the program with prefix of ~ to ensure it continuously polls for the change and executes it when detected one.

Like :


sbt> ~run


Ok, show me a small clip with example

Here you go

GIF on how to use tilde and run on-the-go


Similarly, you can do the same for testOnly command to build your test cases.

Here you go for the test suite example

GIF on how to use tilde and run test cases on the go


Wonderful, ain't it?
Let me know your thoughts in the comment section.

No comments:

Post a Comment