This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-25
Channels
- # announcements (4)
- # babashka (3)
- # beginners (79)
- # biff (4)
- # calva (17)
- # cider (18)
- # clj-kondo (21)
- # cljdoc (45)
- # cljs-dev (14)
- # cljsrn (9)
- # clojure (90)
- # clojure-europe (86)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-portugal (1)
- # clojure-uk (9)
- # clojurescript (20)
- # code-reviews (23)
- # conjure (14)
- # cursive (12)
- # datascript (12)
- # emacs (5)
- # events (2)
- # fulcro (13)
- # gratitude (1)
- # holy-lambda (9)
- # lambdaisland (2)
- # malli (6)
- # nbb (1)
- # nextjournal (2)
- # nrepl (30)
- # off-topic (63)
- # pathom (1)
- # portal (24)
- # reagent (5)
- # reitit (13)
- # releases (2)
- # remote-jobs (1)
- # sci (90)
- # shadow-cljs (49)
- # spacemacs (5)
- # sql (13)
- # testing (20)
- # tools-build (17)
- # xtdb (27)
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
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
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)
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 :thinking_face: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.
Does the "parameters" field pass through to CLJ internally?