Open dustingetz opened 2 years ago
Solution from slack: https://clojurians.slack.com/archives/C7Q9GSHFV/p1650824587456189
; project.clj
:test-paths ["test"]
:profiles {
:test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]
:aliases {"run-tests" ["run" "-m" "app.core-test/run-tests" :project/test-paths]}}
}
;app_test.clj
(ns app.core-test
(:require [clojure.test :as test]
[app.config]))
(defn run-tests [args]
(test/run-tests 'app.config))
;how to run it (terminal)
lein with-profile test run-tests
; references
; https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md#not-writing-a-plugin-%E6%97%A0%E4%B8%BA
; https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
I'd be happy to learn about better/cleaner way to do this. At the moment this approach works for my needs.
Thanks for sharing this!
A minimal project.clj
:
(defproject my/project "0.0.0"
:dependencies [[org.clojure/clojure "1.10.3"]]
:profiles {:test {:dependencies [[com.hyperfiddle/rcf "20220405"]]
:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}})
Then run lein test
If you have tests
forms in your src
folder:
(defproject my/project "0.0.0"
:dependencies [[org.clojure/clojure "1.10.3"]
[com.hyperfiddle/rcf "20220405"]]
:profiles {:test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]
:test-paths ["test" "src"]}})
Oh wow, it's obvious now. Thanks a lot :)
I would love for this to be documented for newbies like me :)
Reopening to add to readme
Question is: "Basically just be able to use RCF with lein. It would be great if i can 'lein test' and it works."