Created
August 30, 2016 17:37
-
-
Save Jell/76abeb78e8c472119079b951b1c2e9f5 to your computer and use it in GitHub Desktop.
CLJS run single test var
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
(ns cljs.test.repl | |
(:require [cljs.analyzer.api :as ana-api] | |
[cljs.analyzer :as ana] | |
[cljs.test])) | |
(defmacro run-single-test [[quote var :as form]] | |
(let [ns (or (some-> var namespace symbol) | |
ana/*cljs-ns*)] | |
`(cljs.test/run-block | |
(concat | |
[(fn [] | |
(cljs.test/set-env! (cljs.test/empty-env)) | |
~(when (ana-api/ns-resolve ns 'cljs-test-once-fixtures) | |
`(cljs.test/update-current-env! [:once-fixtures] assoc '~ns | |
~(symbol (name ns) "cljs-test-once-fixtures"))) | |
~(when (ana-api/ns-resolve ns 'cljs-test-each-fixtures) | |
`(cljs.test/update-current-env! [:each-fixtures] assoc '~ns | |
~(symbol (name ns) "cljs-test-each-fixtures"))))] | |
(cljs.test/test-vars-block [~form]) | |
[(fn [] | |
(cljs.test/report (merge (:report-counters (cljs.test/get-current-env)) | |
{:type :summary :ns ~ns})) | |
(cljs.test/clear-env!))])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment