Open magnars opened 8 years ago
Hi @magnars,
That sounds like a great idea. Do you know of any other tools that implement this? (don't need to be Clojure, but more readable if so)
I haven't had the same issue with other test frameworks. That might be because they are slower in detecting changes, tho. I don't know their internal workings.
I see that you're using cljs.build.api/watch
to be notified of changes. I wonder what would happen if you just passed a debounced function to :watch-fn
.
I'd be happy to try out a few things and report back to you, possibly with a pull request, if you're interested.
Yes, :watch-fn
would be a good place to wrap with a bounced function. There are some reasons to look for a guideline implementation:
I am definitely interest. Any progress you can make will speed things along, since I am running behind with general maintenance as I have been very busy lately.
Some inspiration could be taken from lein auto
. The wait time there is 50ms by default, as suggested, and changing the wait time is done like this in project.clj
:
:auto {"doo" {:wait-time 500}}
I haven't tried it myself, but I guess you could probably set :wait-time
to 0. Which would be the same as disabling it. :wait-time
is passed directly to Thread/sleep
, so there's no special value to disable.
Meanwhile, lein-test-refresh
has a hardcoded sleep of 200ms before rerunning tests.
Hi!
Thanks a lot for doo - finally a test runner for cljs that works great. :)
One of the things I really love with doo is how fast it re-runs my tests after a save. However, it is so excellent in this, that if you perform many file changes at once (eg with "save all" or when changing branches), doo will run all the tests many times - once for each change.
Maybe the test runner could have a soft debounce (50ms?) to gather up all the changes and run the tests once in this case?