Hi, one question regarding https://github.com/hyperfiddle/rcf and IntelliJ Idea (with Cursive):
How do I configure the Run/Debug Config, so that I can test the generated tests with the intellij tooling?
Edit: Basically Iβm asking how to configure {:aliases {:test {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}}} + clj -M:test -e "(require 'example)(clojure.test/run-tests 'example)" as clojure.test execution
I think I donβt need to record a video. The question boils down to this:
I have deps.edn
{:paths ["src"]
:deps {com.datomic/client-api {:mvn/version "1.0.58"}
com.hyperfiddle/rcf {:mvn/version "20220405"}
com.walmartlabs/lacinia {:mvn/version "1.1"}
org.clojure/clojure {:mvn/version "1.11.1"}}
:aliases {:repl {:extra-paths ["dev"]}
:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
{:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}
; clj -M:test-rcf -e "(require 'datomic-lacinia.utils)(clojure.test/run-tests 'datomic-lacinia.utils)"
:test-rcf {:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}}}
How can I configure alias :test to also run the RCF tests?You can put the JVM flag to generate clojure.test/deftests under :test but the problem is if you start moving or renaming tests at the REPL you will probably dangle old tests, because RCF tests do not have identity (they aren't named, clojure.test tests have names)
this issue: https://github.com/hyperfiddle/rcf/issues/41
We are planning to have that capability but no ETA, our next technical alpha needs to be released first
hmm, I donβt know whether that would be an issue for me (since itβs single runs of clj -M:test )
when I put :jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"] into :test it doesnβt do anything because the testrunner ist only using the test dir.
but when I provide src as test dir with
β1 β clj -M:test -d src
Running tests in #{"src"}
Testing user
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
it doesnβt find the rcf tests π€I think it means the namespaces aren't loaded, are you in control of the command line incantation?
e.g. i would expect this to work clj -M:test"(require 'datomic-lacinia.utils)(clojure.test/run-tests 'datomic-lacinia.utils)"
sadly that doesnβt work even with -e variations
But yes, I see why cognitect.test-runner is not picking up the RCF tests. The namespaces are not evaluated/loaded yet, and thatβs why the macro expansion did not happen yet. (Well I think that whats going on.)
success!
β clj -M:test -d src -n datomic-lacinia.utils
Running tests in #{"src"}
Testing datomic-lacinia.utils
β
β
β
β
β
.β
β
β
β
β
β
.β
β
β
β
β
.
Ran 3 tests containing 16 assertions.
0 failures, 0 errors.ok, perfect, namespace regex does work too
β clj -M:test -d src -r "datomic-lacinia.*"
Running tests in #{"src"}
Testing datomic-lacinia.graphql
β
.β
β
β
.β
.
Testing datomic-lacinia.types
β
β
β
β
.β
β
β
.
Testing datomic-lacinia.utils
β
β
β
β
β
.β
β
β
β
β
β
.β
β
β
β
β
.
Ran 8 tests containing 28 assertions.
0 failures, 0 errors.Great - do you have it working in Cursive now?
sadly no, but clj -M:test works now with all tests
{:paths ["src"]
:deps {com.datomic/client-api {:mvn/version "1.0.58"}
com.hyperfiddle/rcf {:mvn/version "20220405"}
com.walmartlabs/lacinia {:mvn/version "1.1"}
org.clojure/clojure {:mvn/version "1.11.1"}}
:aliases {:repl {:extra-paths ["dev"]}
:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
{:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
:main-opts ["-m" "cognitect.test-runner" "-d" "src" "-d" "test" "-r" "datomic-lacinia.*"]
:exec-fn cognitect.test-runner.api/test
:jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true"]}}}
β clj -M:test
Running tests in #{"src" "test"}
Testing datomic-lacinia.graphql
β
.β
β
β
.β
.
Testing datomic-lacinia.types
β
β
β
β
.β
β
β
.
Testing datomic-lacinia.utils
β
β
β
β
β
.β
β
β
β
β
β
.β
β
β
β
β
.
Testing datomic-lacinia.schema-test
.
Ran 9 tests containing 29 assertions.
0 failures, 0 errors.cursive still just picks up the normal tests
I guess it overrides some of the deps alias config π
Does the "parameters" field pass through to CLJ internally?
I donβt know, it doesnβt seem to do anything π
I guess I ask in #cursive whether they have any clues π Thank you for helping and following along! π
Hi Malte, thank you for trying RCF! We don't know what this is: "so that I can test the generated tests with the intellij tooling" Can you take a Loom video of your old workflow that you desire to integrate with? So we can understand concretely, exactly what it is you want to do https://www.loom.com/ - a fast and easy way to record short videos and share a link in a couple clicks
1-2 screenshots would also probably suffice
Hi Dustin, oh good question. Iβll try to capture a better example later. For now I found this: Basically Iβm used to the βclojure.testβ Test Runner here: https://cursive-ide.com/userguide/testing.html Iβm wondering what to input in picture one and two to get testing feedback displayed similar to picture three and possibly four