diff --git a/project.clj b/project.clj index 84066f1..a09819d 100644 --- a/project.clj +++ b/project.clj @@ -16,7 +16,10 @@ :test {:plugins [[com.cemerick/clojurescript.test "0.2.1"]] :cljsbuild {:builds - {:client {:source-paths ["test"]}}}} + {:client {:source-paths ^:replace + ["test" "src" "demo" + "examples/todomvc/src" + "examples/simple/src"]}}}} :srcmap {:cljsbuild {:builds {:client diff --git a/test/runtests.cljs b/test/runtests.cljs index 0202ca2..33db49a 100644 --- a/test/runtests.cljs +++ b/test/runtests.cljs @@ -1,23 +1,14 @@ (ns runtests - (:require-macros [cemerick.cljs.test - :refer (is deftest with-test run-tests testing)] - [reagent.debug :refer [dbg println]]) - (:require [cemerick.cljs.test :as t] - [reagent.core :as reagent :refer [atom]] - [demo :as demo])) + (:require [reagent.core :as reagent :refer [atom]] + [reagent.debug :refer-macros [dbg println]] + [demo :as demo] + [cemerick.cljs.test :as t])) (enable-console-print!) (def test-results (atom nil)) -(js/setTimeout - (fn [] - (println "-----------------------------------------") - (reset! test-results (t/run-all-tests)) - (println "-----------------------------------------")) - (if reagent/is-client 1000 0)) - (defn test-output [] (let [res @test-results] [:div {:style {:margin-top "40px"}} @@ -44,3 +35,17 @@ (defn ^:export mounttests [] (reagent/render-component [test-demo] (.-body js/document))) + +(defn ^:export run-all-tests [] + (println "-----------------------------------------") + (try + (reset! test-results (t/run-all-tests)) + (catch js/Object e + (do + (println "Testrun failed\n" e "\n" (.-stack e)) + (reset! test-results {:error e})))) + (println "-----------------------------------------")) + +(if reagent/is-client + (js/setTimeout run-all-tests 1000) + (run-all-tests))