Last active
August 29, 2015 14:24
-
-
Save viesti/cef01b3bd76205c29757 to your computer and use it in GitHub Desktop.
count test vars for cljs.test
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 karma.macros | |
(:require [cljs.analyzer.api :as ana-api])) | |
(defmacro ns-metas [re] | |
(mapv (fn [ns] | |
`(ns-interns ~['quote ns])) | |
(filter #(re-matches re (str %)) | |
(ana-api/all-ns)))) | |
----------------------------------------------------------------- | |
(ns karma-adapter | |
(:require your.app.components-test | |
your.app.another-ns-under-test) | |
[karma.macros :refer-macros [ns-metas]]) | |
(defn count-test-vars [ns-meta-list] | |
(reduce + (for [ns-meta ns-meta-list] | |
(count (filter (fn [[_ v]] (:test (meta v))) ns-meta))))) | |
{:total (count-test-vars (ns-metas #"your.app.*-test$"))} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment