Is there interest in using a code coverage tool with on the clojure-lsp codebase? I've been experimenting with https://github.com/flow-storm/clofidence. (thread)
Embarrassingly, I see a few functions that I created that don't have any test coverage! 😞 I'll fix that!
A quick patch to get it working is
diff --git a/lib/deps.edn b/lib/deps.edn
index 569ef77c..0e9e5096 100644
--- a/lib/deps.edn
+++ b/lib/deps.edn
@@ -34,6 +34,15 @@
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
:extra-paths ["test"]
:main-opts ["-m" "kaocha.runner"]}
+ :clofidence {:classpath-overrides {org.clojure/clojure nil}
+ :extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.5"}
+ com.github.flow-storm/clofidence {:mvn/version "LATEST"}}
+ :exec-fn clofidence.main/run
+ :exec-args {:report-name "Hansel"
+ :test-fn kaocha.runner/-main*
+ :test-fn-args []}
+ :jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes=hansel"
+ "-Dclojure.storm.instrumentSkipRegex=.*test.*"]}
:cognitest {:extra-paths ["test"]
:extra-deps {clojure-lsp/test-helper {:local/root "../test-helper"}
io.github.cognitect-labs/test-runner
diff --git a/scripts/make.clj b/scripts/make.clj
index fd803036..0bf74d45 100644
--- a/scripts/make.clj
+++ b/scripts/make.clj
@@ -56,7 +56,7 @@
(defn ^:private unit-test [dir]
(println :running-unit-tests... dir)
- (clj! dir ["-M:test"])
+ (clj! dir ["-X:test:clofidence"])
(println))
(defn ^:private mv-here [file]clofidence isn't static analysis I think though
oh you mean, not to build it into clojure-lsp for code analysis, but to run it on clojure-lsp
Yeah. Sorry, I tried to word it less confusingly, but failed 😞
s/with/on/
yeah that looks pretty useful!
there's also cloverage btw
I checked out cloverage too. It works more like code coverage tools that I've used with Java projects, but there were issues
Minor issues, granted, but it seemed like it didn't always get all the branching correct
ah ok
Yeah, you need to run the unit tests