diff --git a/deps-clr.edn b/deps-clr.edn new file mode 100644 index 0000000..9cddbab --- /dev/null +++ b/deps-clr.edn @@ -0,0 +1,7 @@ +{:paths ["src"] + :deps {io.github.clojure/clr.tools.namespace {:git/tag "v1.5.4" :git/sha "46d81cb"} + io.github.clojure/tools.cli {:git/tag "v1.1.230" :git/sha "717e187"}} + :aliases {:test {:extra-paths ["test"] + :extra-deps {io.github.clojure/clr.test.check {:git/tag "v1.1.2" :git/sha "26f34e6"}} + :main-opts ["-m" "cognitect.test-runner"] + :exec-fn cognitect.test-runner.api/test}}} diff --git a/readme.md b/readme.md index 68945ee..ee7028e 100644 --- a/readme.md +++ b/readme.md @@ -25,14 +25,19 @@ suite of decomplected project management tools. ## Configuration +This fork of test-runner has a port of the JVM version to run in CLR; +this is in the clr-port branch. + + + Include a dependency on this project in your `deps.edn`. You will probably wish to put it in the `test` alias: ```clojure -;; v0.5.1 +;; v0.5.3 :aliases {:test {:extra-paths ["test"] :extra-deps {io.github.cognitect-labs/test-runner - {:git/tag "v0.5.1" :git/sha "dfb30dd"}} + {:git/tag "v0.5.3clr" :git/sha "ae91dd2"}} :main-opts ["-m" "cognitect.test-runner"] :exec-fn cognitect.test-runner.api/test}} ``` diff --git a/src/cognitect/test_runner.clj b/src/cognitect/test_runner.cljc similarity index 89% rename from src/cognitect/test_runner.clj rename to src/cognitect/test_runner.cljc index 122e7e8..6651687 100644 --- a/src/cognitect/test_runner.clj +++ b/src/cognitect/test_runner.cljc @@ -1,6 +1,7 @@ (ns cognitect.test-runner (:require [clojure.tools.namespace.find :as find] - [clojure.java.io :as io] + #?(:clj [clojure.java.io :as io] + :cljr [clojure.clr.io :as io]) [clojure.test :as test] [clojure.tools.cli :as cli]) (:refer-clojure :exclude [test])) @@ -63,9 +64,11 @@ [options] (let [dirs (or (:dir options) #{"test"}) + nses (->> dirs - (map io/file) - (mapcat find/find-namespaces-in-dir)) + #?(:clj (map io/file) + :cljr (map io/dir-info)) + (mapcat #(find/find-namespaces-in-dir % #?(:cljr find/cljr :default nil)))) nses (filter (ns-filter options) nses)] (println (format "\nRunning tests in %s" dirs)) (dorun (map require nses)) @@ -77,7 +80,7 @@ (defn- parse-kw [^String s] - (if (.startsWith s ":") (read-string s) (keyword s))) + (if (#?(:clj .startsWith :cljr .StartsWith) s ":") (read-string s) (keyword s))) (defn- accumulate [m k v] @@ -120,12 +123,12 @@ (do (doseq [e (:errors args)] (println e)) (help args) - (System/exit 1)) + (#?(:clj System/exit :cljr Environment/Exit) 1)) (if (-> args :options :test-help) (help args) (try (let [{:keys [fail error]} (test (:options args))] - (System/exit (if (zero? (+ fail error)) 0 1))) + (#?(:clj System/exit :cljr Environment/Exit) (if (zero? (+ fail error)) 0 1))) (finally ;; Only called if `test` raises an exception (shutdown-agents)))))))