Fix test-running under advanced compilation

Turns out that clojurescript.test breaks unless the test
directory is included first, but only with advanced compilation
and only on the first run...
This commit is contained in:
Dan Holmsand 2014-01-25 17:02:58 +01:00
parent f9d0b58af8
commit 23a5f80197
2 changed files with 22 additions and 14 deletions

View File

@ -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

View File

@ -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))