build.clj 646 B

123456789101112131415161718
  1. (ns build
  2. (:refer-clojure :exclude [test])
  3. (:require [clojure.tools.build.api :as b]
  4. [clojure.tools.deps :as t]))
  5. (defn test "Run all the tests."
  6. [_opts]
  7. (println "\nRunning tests...")
  8. (let [basis (b/create-basis {:aliases [:test]})
  9. combined (t/combine-aliases basis [:test])
  10. cmds (b/java-command
  11. {:basis basis
  12. :java-opts (:jvm-opts combined)
  13. :main 'clojure.main
  14. :main-args ["-m" "cognitect.test-runner"]})
  15. {:keys [exit]} (b/process cmds)]
  16. (when-not (zero? exit)
  17. (throw (ex-info "Tests failed" {})))))