diff --git a/Makefile b/Makefile index 75cd455..00de469 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ run: figwheel runsite: @$(MAKE) run PROF=dev,site,$(PROF) +# development build with figwheel, but no tests +runnotest: + @$(MAKE) run PROF=dev-notest,$(PROF) + # production build with auto-rebuild runprod: clean @$(MAKE) serve-site PROF=prod,$(PROF) diff --git a/project.clj b/project.clj index 160a30f..34ab464 100644 --- a/project.clj +++ b/project.clj @@ -14,21 +14,22 @@ :profiles {:test {:cljsbuild {:builds {:client {:source-paths ["test"]}}}} - :dev-base {:dependencies [[figwheel "0.2.3-SNAPSHOT"]] - :plugins [[lein-figwheel "0.2.3-SNAPSHOT"]] - :source-paths ["demo"] ;; for lighttable - :resource-paths ["site" "outsite"] - :figwheel {:css-dirs ["site/public/css"]} - :cljsbuild - {:builds - {:client - {:source-paths ["env/dev"] - :compiler {:main "reagentdemo.dev" - :source-map true - :source-map-timestamp true - :optimizations :none - :output-dir "outsite/public/js/out" - :asset-path "js/out"}}}}} + :dev [:test + {:dependencies [[figwheel "0.2.3-SNAPSHOT"]] + :plugins [[lein-figwheel "0.2.3-SNAPSHOT"]] + :source-paths ["demo"] ;; for lighttable + :resource-paths ["site" "outsite"] + :figwheel {:css-dirs ["site/public/css"]} + :cljsbuild + {:builds + {:client + {:source-paths ["env/dev"] + :compiler {:main "reagentdemo.dev" + :source-map true + :source-map-timestamp true + :optimizations :none + :output-dir "outsite/public/js/out" + :asset-path "js/out"}}}}}] :site {:resource-paths ^:replace ["outsite"] :figwheel {:css-dirs ^:replace ["outsite/public/css"]} @@ -43,9 +44,13 @@ :elide-asserts true :pretty-print false :output-dir "target/client"}}}}}] + + :prod-test [:test :prod] - :dev [:test :dev-base] - :prod-test [:test :prod]} + :dev-notest [:dev + {:cljsbuild + {:builds {:client + {:compiler {:load-tests false}}}}}]} :clean-targets ^{:protect false} [:target-path :compile-path "outsite/public/js" diff --git a/test/reagenttest/runtests.cljs b/test/reagenttest/runtests.cljs index e673339..68d2553 100644 --- a/test/reagenttest/runtests.cljs +++ b/test/reagenttest/runtests.cljs @@ -44,5 +44,7 @@ (js/setTimeout all-tests 100) (all-tests))) -(reset! demo/test-results [#'test-output-mini]) -(run-tests) +(when (some? (test/deftest empty-test)) + ;; Only run with :load-tests true + (reset! demo/test-results [#'test-output-mini]) + (run-tests)) diff --git a/test/reagenttest/testcursor.cljs b/test/reagenttest/testcursor.cljs index 54d6fd1..73f64bd 100644 --- a/test/reagenttest/testcursor.cljs +++ b/test/reagenttest/testcursor.cljs @@ -6,9 +6,9 @@ ;; this repeats all the atom tests but using cursors instead -(set! rv/debug true) - -(defn running [] (rv/running)) +(defn running [] + (set! rv/debug true) + (rv/running)) (defn dispose [v] (rv/dispose! v)) (deftest basic-cursor diff --git a/test/reagenttest/testreagent.cljs b/test/reagenttest/testreagent.cljs index 6c0b6f7..51e1f8b 100644 --- a/test/reagenttest/testreagent.cljs +++ b/test/reagenttest/testreagent.cljs @@ -7,8 +7,7 @@ (defn running [] (rv/running)) -(def isClient (not (nil? (try (.-document js/window) - (catch js/Object e nil))))) +(def isClient reagent/is-client) (def rflush reagent/flush)