Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Added

- Add `--cov-{line,form}-fail-threshold` to specify the cloverage
`:{line,form}-fail-threshold` parameters.

## Fixed

## Changed
Expand Down Expand Up @@ -87,4 +90,4 @@

## Changed

- Initial release
- Initial release
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Alternatively Cloverage can be configured through `tests.edn`. Source paths spec
:lcov? false,
:high-watermark 80,
:fail-threshold 0,
:line-fail-threshold 0,
:form-fail-threshold 0,
:output "target/coverage",
:low-watermark 50,
:ns-regex [],
Expand Down Expand Up @@ -135,4 +137,4 @@ changes are justified.
Copyright © 2018-2020 Arne Brasseur and contributors

Available under the terms of the Eclipse Public License 1.0, see LICENSE.txt
<!-- /license -->
<!-- /license -->
14 changes: 14 additions & 0 deletions src/kaocha/plugin/cloverage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
:coveralls? false
:summary? true
:fail-threshold 0
:line-fail-threshold 0
:form-fail-threshold 0
:low-watermark 50
:high-watermark 80
:nop? false
Expand All @@ -46,6 +48,12 @@
["--cov-fail-threshold PERCENT"
"Sets the percentage threshold at which cloverage will abort the build. Default: 0%"
:parse-fn #(Integer/parseInt %)]
["--cov-line-fail-threshold PERCENT"
"Sets the percentage threshold at which cloverage will abort the build. Default: 0%"
:parse-fn #(Integer/parseInt %)]
["--cov-form-fail-threshold PERCENT"
"Sets the percentage threshold at which cloverage will abort the build. Default: 0%"
:parse-fn #(Integer/parseInt %)]
["--cov-low-watermark PERCENT"
"Sets the low watermark percentage (valid values 0..100). Default: 50%"
:parse-fn #(Integer/parseInt %)]
Expand Down Expand Up @@ -103,6 +111,12 @@
(contains? opts :cov-fail-threshold)
(assoc :fail-threshold (:cov-fail-threshold opts))

(contains? opts :cov-line-fail-threshold)
(assoc :line-fail-threshold (:cov-line-fail-threshold opts))

(contains? opts :cov-form-fail-threshold)
(assoc :form-fail-threshold (:cov-form-fail-threshold opts))

(contains? opts :cov-low-watermark)
(assoc :low-watermark (:cov-low-watermark opts))

Expand Down
12 changes: 12 additions & 0 deletions test/unit/kaocha/plugin/cloverage_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@
(is (match? {:fail-threshold 42} (update-config' {:fail-threshold 20} ["--cov-fail-threshold" "42"])))
(is (match? {:fail-threshold 42} (update-config' {} ["--cov-fail-threshold" "42"]))))

(testing "--cov-line-fail-threshold PERCENT"
(is (match? {:line-fail-threshold 0} (update-config' {} [])))
(is (match? {:line-fail-threshold 20} (update-config' {:line-fail-threshold 20} [])))
(is (match? {:line-fail-threshold 42} (update-config' {:line-fail-threshold 20} ["--cov-line-fail-threshold" "42"])))
(is (match? {:line-fail-threshold 42} (update-config' {} ["--cov-line-fail-threshold" "42"]))))

(testing "--cov-form-fail-threshold PERCENT"
(is (match? {:form-fail-threshold 0} (update-config' {} [])))
(is (match? {:form-fail-threshold 20} (update-config' {:form-fail-threshold 20} [])))
(is (match? {:form-fail-threshold 42} (update-config' {:form-fail-threshold 20} ["--cov-form-fail-threshold" "42"])))
(is (match? {:form-fail-threshold 42} (update-config' {} ["--cov-form-fail-threshold" "42"]))))

(testing "--cov-low-watermark PERCENT"
(is (match? {:low-watermark 50} (update-config' {} [])))
(is (match? {:low-watermark 20} (update-config' {:low-watermark 20} [])))
Expand Down