Konrad Mrożek
2024-01-12 cdb7cc02e4041f28e3bd9f0f78cf862f4b63e96f
clojure/src/test_runner.clj
@@ -1,4 +1,7 @@
(ns test-runner)
(ns test-runner
  (:require
   [clojure.string :as string]
   [clojure.test :as t]))
(def class-cache-dir ".cache/classes")
(.mkdirs (java.io.File. class-cache-dir))
@@ -111,6 +114,8 @@
        (println "Malli detected. Instrument functions...")
        (require 'malli.dev)
        (require 'malli.dev.pretty)
        (require 'malli.dev.virhe)
        (alter-var-root (get (ns-publics 'malli.dev.virhe) '-color) (constantly (fn [_ body _] [:span body])))
        ((find-var 'malli.dev/start!) {:report ((find-var 'malli.dev.pretty/thrower))}))
      (let [test-namespaces (->> (all-ns)
                                 (mapcat ns-publics)
@@ -119,6 +124,16 @@
                                 (filter (comp test-files :file))
                                 (map :ns)
                                 (set))]
        (set-validator! #'t/*testing-contexts*
                        (let [validator (get-validator #'t/*testing-contexts*)]
                          (fn [v]
                            (println "Testing:" (string/join " " v))
                            (println)
                            (if validator
                              (validator v)
                              true))))
        (with-redefs [t/report vim-report]
          (System/exit
           (if (pos? (if (and -test-file -test-line)