I’ve been playing around with Cloverage a bit over the last couple of days — https://github.com/cloverage/cloverage — using it via the Clojure CLI / deps.edn
. How useful do folks find test coverage? Are there quirks of Cloverage that make it less useful? (I suspect so, based on my experiments so far) For folks who are looking at coverage under tests, do you find yourself adding “minimal” tests just to improve coverage, rather than actually useful tests?
Last time I used it in a team setting, indeed its issues made it hard to make it a "hard check" in CI. We ran it as an informative step - people could click around and see the stats. (Other informative steps can be e.g. reflection / boxed-math warnings) At least the situation has improved a bit over the last two years
One thing that has worked well for me is having a checklist as a PR template. It can have a checkbox for test coverage self-assessment
in some projects we couldn't run it at all luckily the architecture avoided "mega" codebases - by using multirepos or clean monorepos - one has N codebases, N test suites. So one can discard Cloverage only in a subset of those test suites
Yeah, I tried it on our whole codebase about over 400 tests threw exceptions. Running it on individual subprojects seems to be safe enough so far. There seem to be some constructs it just doesn't do very well with -- it flags clojure.tools.logging
calls, for example, as not being "fully-exercised" (even when those lines are executed, so I'm not sure what path it thinks has been missed?), and defonce
also seems to trip it up.
I make use of cloverage for rewrite-clj, and have https://github.com/clj-commons/rewrite-clj/blob/main/doc/02-developer-guide.adoc#code-coverage.