Created
August 7, 2016 10:23
-
-
Save FossiFoo/fa3117c25fe7fb13bc7f863fd35d95b4 to your computer and use it in GitHub Desktop.
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 cloverage.boot-cloverage | |
(:require [boot.core :as core] | |
[boot.pod :as pod] | |
[boot.util :as util])) | |
(def ^:private deps | |
'[[cloverage "1.0.8-SNAPSHOT"]]) | |
(core/deftask cloverage | |
"cloverage analysis" | |
[] | |
(let [pod (-> (core/get-env) | |
(update-in [:dependencies] into deps) | |
(update-in [:source-paths] conj "test") | |
pod/make-pod | |
future)] | |
(core/with-post-wrap fileset | |
(let [code-namespaces (core/fileset-namespaces fileset) | |
code-ns-names (map name code-namespaces) | |
test-dir "test" | |
args (into ["--test-ns-path" test-dir] code-ns-names)] | |
(util/info "running cloverage with %s%n" (pr-str args)) | |
(pod/with-eval-in @pod | |
(boot.pod/add-classpath ~test-dir) ; puts test-dir on the classpath, but doesn't run/require yet | |
(doseq [ns '~code-namespaces] (require ns)) ; puts the code-namespaces on the classpatch and requires them | |
(require 'cloverage.coverage) ; we also need to resolve cloverage itself | |
(cloverage.coverage/-main ~@args)))))) ; args include code-namespace names, so cloverage does not need to resolve them, test-dir will be scanned for tests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment