kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
robert-stuttaford 2020-05-13T08:06:42.206600Z

hello @plexus - i hope you're doing well today 🙂 we use bultitude to find namespaces for a specific sub-system. on java 8, our tests for this code work fine. however, on java 11, bultitude seems to have lost access to all the files in the src folder, when running the tests via kaocha. i've done some digging, and i've been able to confirm that the code in the deps.edn profile in the test folder works fine outside of the kaocha runner. i've even altered the kaocha config to force src into the test-paths, with no joy. does any of this trigger a known gotcha that i might be able to look into for you?

plexus 2020-05-13T08:08:16.207400Z

We do some funny shenanigans to dynamically add :test-paths to the classpath. Maybe that's getting in your way?

plexus 2020-05-13T08:08:53.207700Z

See kaocha.classpath @robert-stuttaford

robert-stuttaford 2020-05-13T08:08:59.207900Z

thanks i'll read!

plexus 2020-05-13T08:09:42.208400Z

if that's the culprit then I think we can add a flag to disable that and let people manage their own classpath

robert-stuttaford 2020-05-13T08:12:04.209700Z

i'm pretty sure this is the cause, but i couldn't tell you why specifically - what i see from inside the K run is that only ./test is on the CP and ./src is not. is it perhaps possible there's a java 11 bug in dynapath?

robert-stuttaford 2020-05-13T08:12:14.210100Z

given that it's mucking with classpaths directly

robert-stuttaford 2020-05-13T08:12:36.210500Z

thanks for the quick response btw ^_^

plexus 2020-05-13T08:14:10.211900Z

definitely not impossible. I'm not familiar with bultitude but it may also depend on how it figures out the classpath. Does it only look at the current context classloader, or does it follow the chain of classloaders?

robert-stuttaford 2020-05-13T08:14:42.212300Z

pretty sure its just the former

plexus 2020-05-13T08:14:59.212700Z

classpath is a bit of a murky concept 🙂 more than one way to determine what "the classpath" is

robert-stuttaford 2020-05-13T08:16:18.213800Z

oh man i feel like i am looking over the edge into a deep dark hole here haha

plexus 2020-05-13T08:16:56.214400Z

yeah so that's likely what's happening here. Not all classloaders are modifiable, so to be able to modify the classpath we add a new clojure.lang.DynamicClassLoader to the top of the chain

robert-stuttaford 2020-05-13T08:17:39.215300Z

it's calling clojure.java.classpath/classpathhttps://github.com/TimoFreiberg/bultitude/blob/master/src/bultitude/core.clj#L125

plexus 2020-05-13T08:18:14.215900Z

mostly got this working through trial and error, I'm also no export in these JVM specifics. I'm more surprised that it's taken this long before this caused an issue for someone.

robert-stuttaford 2020-05-13T08:18:40.216400Z

my guess is you had to do this to insulate from the different tool contexts - lein/deps/boot?

robert-stuttaford 2020-05-13T08:18:56.217Z

selfishly, it'd be great if, for our deps case, it just used whatever deps gave it

robert-stuttaford 2020-05-13T08:19:37.218Z

given that, it sounds like your suggestion of an opt-out flag is the right way to go then

plexus 2020-05-13T08:19:41.218200Z

the idea was mainly that you wouldn't have to configure your test paths twice, since we do need to know what your test paths are e.g for --watch or for code coverage

plexus 2020-05-13T08:20:23.219Z

but yeah in practice generally people already have their test paths in their deps.edn or whatever anyway, e.g. for REPL driven dev

robert-stuttaford 2020-05-13T08:26:54.219600Z

thanks for taking the time to talk @plexus 🙂

plexus 2020-05-13T08:32:37.220600Z

@robert-stuttaford try {lambdaisland/kaocha {:mvn/version "1.0.632"}}, and add :kaocha.testable/skip-add-classpath? true to the test suite config (so not the top level config but at the same level where you have :test-paths)

robert-stuttaford 2020-05-13T08:33:07.220900Z

ok wow that's awesome i'll try that! thank you sir

plexus 2020-05-13T08:35:51.221500Z

it's a one line change but I will admit I did not actually test it. Testing in production like a pro 💪:skin-tone-2:

robert-stuttaford 2020-05-13T08:36:14.221700Z

haha all good, i'll try it out

dominicm 2020-05-13T11:03:09.223Z

In java 11, clojure.java.classpath can no longer reflect against the base classloader.

plexus 2020-05-13T13:45:17.223500Z

I've pushed a lot of improvements to Chui today, and highly encourage people to try it

🔨 2
🎉 1
Sean Poulter 2020-05-14T13:24:02.230600Z

On it.

plexus 2020-05-13T13:45:48.224100Z

Assuming you are using shadow-cljs and :target :browser-test

plexus 2020-05-13T13:47:01.225300Z

We'll eventually figure out instructions for figwheel and cljs.main, but to provide the same experience we'll need some extra functionality in figwheel or clojurescript to detect test namespaces and inject them into the build.

plexus 2020-05-13T13:48:27.225800Z

with many thanks to @anantpaatra for his great work on the UI design

👏 1
😅 1
felipebarros 2020-05-13T13:51:23.228100Z

Feedbacks on the UI are appreciated as well!

2020-05-13T21:34:21.229600Z

Is there something i need to do in order to enable Expound output when running tests? i'm executing the normal -m "kaocha.runner" i see expound alluded to in the docs and could but not how to enable it. i'm too tired to read raw spec errors all day 🙂