Created
December 7, 2018 11:00
-
-
Save mrroman/40ccf400fd312fbf0bdb7baf19a2778f to your computer and use it in GitHub Desktop.
Simple/fast CLI test runner for all your tests
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 test | |
(:require [clojure.java.io :as io] | |
[clojure.string :as str] | |
[clojure.test :as t])) | |
(defonce test-folder "test") | |
(defonce test-filter #"^myapp.*$") | |
(defn test-file? [path] | |
(str/ends-with? path "_test.clj")) | |
(defn load-tests [] | |
(->> (file-seq (io/file test-folder)) | |
(filter (memfn isFile)) | |
(map (memfn getPath)) | |
(filter test-file?) | |
(sort) | |
(map #(do | |
(println "Loading" %) | |
(load-file %))) | |
(doall))) | |
(defn -main [] | |
(println "Loading tests...") | |
(load-tests) | |
(println "Running tests...") | |
(try | |
(t/run-all-tests test-filter) | |
(finally | |
(shutdown-agents)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put it in your
dev
directory and add an alias to deps.edn, e.g.:Run it with: