diff --git a/frontend/tools.clj b/frontend/tools.clj index 9e5a3e84b..a204050e6 100644 --- a/frontend/tools.clj +++ b/frontend/tools.clj @@ -130,12 +130,9 @@ (task ["dbg-dist:main"]) (task ["dbg-dist:worker"])) - - - ;; --- Tests Tasks -(defmethod task "build-tests" +(defmethod task "build:tests" [& args] (api/build (api/inputs "src" "test") (assoc default-build-options @@ -147,6 +144,30 @@ :output-dir "target/tests/main" :optimizations :none))) +(defmethod task "watch:tests" + [args] + (println "Start watch loop...") + (letfn [(run-tests [] + (let [{:keys [out err]} (shell/sh "node" "target/tests/main.js")] + (println out err))) + (start-watch [] + (try + (api/watch (api/inputs "src" "test") + (assoc default-build-options + :main 'uxbox.tests.main + :watch-fn run-tests + :target :nodejs + :source-map true + :output-to "target/tests/main.js" + :output-dir "target/tests/main" + :optimizations :none)) + (catch Exception e + (println "ERROR:" e) + (Thread/sleep 2000) + start-watch)))] + (trampoline start-watch))) + + ;; --- Figwheel Config & Tasks (def figwheel-builds