mirror of
https://github.com/status-im/reagent.git
synced 2025-01-12 04:44:27 +00:00
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:
parent
f9d0b58af8
commit
23a5f80197
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user