Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use cljs-test-display for :browser-test
fixes #406
- Loading branch information
Showing
4 changed files
with
10 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html><head><title>shadow.test.browser</title><body><pre id="log"></pre><script src="/js/test.js"></script><script>shadow.test.browser.init();</script></body></head></html> | ||
<html><head><title>shadow.test.browser</title><body><script src="/js/test.js"></script><script>shadow.test.browser.init();</script></body></head></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
(ns shadow.test.browser | ||
"generic browser test runner" | ||
(:require [shadow.test :as st] | ||
[shadow.dom :as dom])) | ||
|
||
;; FIXME: implement custom reporter instead | ||
(defonce log-node (dom/by-id "log")) | ||
(when log-node | ||
(set-print-fn! | ||
(fn [s] | ||
(dom/append log-node (str s "\n"))))) | ||
(:require | ||
[shadow.test :as st] | ||
[shadow.dom :as dom] | ||
[cljs-test-display.core :as ctd])) | ||
|
||
(defn start [] | ||
;; (js/console.log "test env" @st/tests-ref) | ||
(st/run-all-tests)) | ||
(st/run-all-tests (ctd/init! "test-root"))) | ||
|
||
(defn stop [done] | ||
(set! (.-innerText log-node) "") | ||
|
||
;; FIXME: determine if async tests are still running | ||
;; and call done after instead | ||
;; otherwise a live reload might interfere with running tests by | ||
;; reloading code in the middle | ||
;; FIXME: determine if async tests are still pending | ||
(done)) | ||
|
||
;; not sure we need to do something once? | ||
(defn ^:export init [] | ||
(dom/append [:div#test-root]) | ||
(start)) |