Fork me on GitHub

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 . For some reason, this does not happen when I am running tests in polylith-kaocha. Related comment and PR where I tried 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


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 . 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.

👍 2

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):

👍 1

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


ok, thanks. Do you htink this should be added to the testing docs ?


I can probably add a PR


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).

👍 1