Skip to content

Commit

Permalink
add more plumbing
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaCrotti committed Sep 21, 2021
1 parent 3f80f9c commit 6952291
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Available options and command-line arguments:
:emma-xml? --no-emma-xml, --emma-xml false Produce an EMMA XML report. [emma.sourceforge.net]
:lcov? --no-lcov, --lcov false Produce a lcov/gcov report.
:codecov? --no-codecov, --codecov false Generate a JSON report for Codecov.io
:cobertura? --no-cobertura, --cobertura false Generate a cobertura report.
:coveralls? --no-coveralls, --coveralls false Send a JSON report to Coveralls if on a CI server
:junit? --no-junit, --junit false Output test results as junit xml file. Supported in :clojure.test runner
:raw? --no-raw, --raw false Output raw coverage data (for debugging).
Expand Down
5 changes: 4 additions & 1 deletion cloverage/src/cloverage/args.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
:junit? boolean?
:lcov? boolean?
:codecov? boolean?
:cobertura? boolean?
:coveralls? boolean?
:summary? boolean?
:colorize? boolean?
Expand Down Expand Up @@ -69,7 +70,7 @@
(def boolean-flags
(letfn [(add-? [k]
[k (keyword (str (name k) \?))])]
(->> [:text :html :raw :emma-xml :junit :lcov :codecov :coveralls :summary :colorize :debug :nop :help]
(->> [:text :html :raw :emma-xml :junit :lcov :codecov :coveralls :cobertura :summary :colorize :debug :nop :help]
(map add-?)
(into {}))))

Expand Down Expand Up @@ -112,6 +113,8 @@
"Produce a lcov/gcov report." :default false]
["--[no-]codecov"
"Generate a JSON report for Codecov.io" :default false]
["--[no-]cobertura"
"Generate a cobertura report" :default false]
["--[no-]coveralls"
"Send a JSON report to Coveralls if on a CI server" :default false]
["--[no-]junit"
Expand Down
6 changes: 4 additions & 2 deletions cloverage/src/cloverage/coverage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[cloverage.instrument :as inst]
[cloverage.report :as rep]
[cloverage.report.codecov :as codecov]
[cloverage.report.cobertura :as cobertura]
[cloverage.report.console :as console]
[cloverage.report.coveralls :as coveralls]
[cloverage.report.emma-xml :as emma-xml]
Expand Down Expand Up @@ -269,7 +270,7 @@
(f arg-map)))

(defn report-results
[{:keys [text? html? raw? emma-xml? lcov? codecov? coveralls? summary? colorize? low-watermark high-watermark
[{:keys [text? html? raw? emma-xml? lcov? codecov? coveralls? cobertura? summary? colorize? low-watermark high-watermark
custom-report ^String output], :as opts}
project-opts
forms]
Expand All @@ -281,6 +282,7 @@
(when lcov? (lcov/report output forms))
(when raw? (raw/report output forms @*covered*))
(when codecov? (codecov/report output forms))
(when cobertura? (cobertura/report output forms))
(when coveralls? (coveralls/report output forms))
(when summary? (console/summary forms low-watermark high-watermark colorize?)))
(when custom-report (launch-custom-report custom-report {:project project-opts
Expand All @@ -297,7 +299,7 @@
failed?)))

(defn run-main
[[{:keys [debug? junit? fail-threshold help? runner test-selectors selector], :as opts} add-nses help] project-opts]
[[{:keys [debug? fail-threshold help?], :as opts} add-nses help] project-opts]
(binding [*ns* (find-ns 'cloverage.coverage)
debug/*debug* debug?]
(if help?
Expand Down
4 changes: 2 additions & 2 deletions cloverage/test/cloverage/coverage_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,15 @@
(slurp (io/file dir-b fname))))

(t/deftest test-all-reporters
(let [generated-files ["coverage.txt" "index.html" "coverage.xml" "lcov.info" "coveralls.json"
(let [generated-files ["coverage.txt" "index.html" "coverage.xml" "lcov.info" "coveralls.json" "cobertura.xml"
#_#_#_"raw-data.clj" "raw-stats.clj" "codecov.json"]]
(doseq [f generated-files]
(clojure.java.io/delete-file (io/file "out" f) true))

(binding [cov/*exit-after-test* false]
(cov/-main
"-o" "out"
"--junit" "--text" "--html" "--raw" "--emma-xml" "--coveralls" "--codecov" "--lcov"
"--junit" "--text" "--html" "--raw" "--emma-xml" "--coveralls" "--codecov" "--lcov" "--cobertura"
"-x" "cloverage.sample.exercise-instrumentation"
"cloverage.sample.exercise-instrumentation")
(doseq [fname generated-files]
Expand Down
1 change: 1 addition & 0 deletions cloverage/tests.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:summary? true,
:coveralls? false,
:emma-xml? false,
:cobertura? false,
:html? true,
:nop? false,
:codecov? false}}

0 comments on commit 6952291

Please sign in to comment.