This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-29
Channels
- # announcements (5)
- # beginners (25)
- # calva (53)
- # clj-kondo (9)
- # clojure (25)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (1)
- # conjure (2)
- # data-science (1)
- # datalevin (4)
- # datascript (6)
- # deps-new (5)
- # emacs (5)
- # etaoin (6)
- # figwheel-main (1)
- # fulcro (46)
- # gratitude (3)
- # hyperfiddle (8)
- # introduce-yourself (13)
- # lsp (13)
- # nextjournal (5)
- # off-topic (2)
- # pathom (4)
- # polylith (11)
- # re-frame (16)
- # releases (4)
- # scittle (67)
- # shadow-cljs (38)
- # slack-help (4)
- # specter (13)
- # sql (29)
- # squint (21)
- # test-check (3)
- # vim (13)
- # xtdb (15)
hello,
SOLVED
how can I pass -Dhyperfiddle.rcf.generate-tests=true
to the JVM that runs the tests via poly test
?
I am trying to get RCF tests in src/ to work .
RCF lib converts rcf tests to clojure.test deftests when that option is on. See https://github.com/hyperfiddle/rcf#ci .
For some reason, this does not happen when I am running tests in polylith-kaocha.
Related comment and PR where I tried https://github.com/imrekoszo/polylith-kaocha/pull/7#issuecomment-1230076907
I did find some information about this in the docs that suggest JVM is reused during tests and only classloader is switched.
> This set of tests will be executed in isolation from its own classloader which will speed up the test execution and make it more reliable.
I know some setups require JVM forking to ensure a clean classloader.
Not sure if this is required at the moment (though I did find strange some class loading issues - but perhaps they are my fault).
it seems I needed to pass the jvm options to :poly alias
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"
;; Run RCF tests when loading files in REPL
;;
"-Dhyperfiddle.rcf.generate-tests=true"]
with this solution, a single pair of jvm options will be used for all tests. This might have some implications / require customizations in some cases
I created a repo to reproduce / document polylith + rcf with default test runner https://github.com/ieugen/poly-rcf .
In order for src/ tests to be "discovered" and run, I needed to add "src"
to :test :extra-paths in bases/rcf .
do you think this is an issue with Poly tool and how it works with tests?
In a normal project, this is not needed. Just adding the rcf jvm-option is enough.
cc @tengstrand
Hi @U011NGC5FFY! I'm busy the whole day, but will try to have a look at this tomorrow.
This is not Polylith-specific -- test runners, in general, do not look at src
to discover tests so the issue you're seeing with RCF is also something you'd see with adding tests via metadata to functions in src
namespaces. I talk a bit about this in the documentation for Expectations (a clojure.test
-compatible library that provides a more expressive syntax for writing tests): https://cljdoc.org/d/com.github.seancorfield/expectations/2.0.160/doc/getting-started#test-placement
so the solution is to add src paths to test as well? in one PR I did use a polylith-kaocha feature to add src paths to test paths via tooling The simpler way sould be to just add src to test paths as well.
Yes @U011NGC5FFY, you need to specify the src
directory under the :test
alias, the same way you did https://github.com/ieugen/poly-rcf/blob/main/bases/rcf/deps.edn.
It's a very unusual approach to have tests in src
code -- that's why it does not work by default with any testing tools. I don't think Polylith should encourage it in its documentation. If you want to persuade the RCF team to document that sort of stuff, that's where I think you should focus your energy. RCF is very niche (it's clever stuff -- I used it for a while and you'll see discussions I'm involved with on the RCF repo, trying to reconcile how it works with a REPL-based workflow, since the tests it generates do not have predictable names).