Fork me on GitHub
#kaocha
<
2020-05-13
>
robert-stuttaford08:05:42

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?

plexus08:05:16

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

robert-stuttaford08:05:59

thanks i'll read!

plexus08:05:42

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

robert-stuttaford08:05:04

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-stuttaford08:05:14

given that it's mucking with classpaths directly

robert-stuttaford08:05:36

thanks for the quick response btw ^_^

plexus08:05:10

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-stuttaford08:05:42

pretty sure its just the former

plexus08:05:59

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

robert-stuttaford08:05:18

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

plexus08:05:56

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

plexus08:05:14

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-stuttaford08:05:40

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

robert-stuttaford08:05:56

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

robert-stuttaford08:05:37

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

plexus08:05:41

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

plexus08:05:23

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-stuttaford08:05:54

thanks for taking the time to talk @plexus 🙂

plexus08:05:37

@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-stuttaford08:05:07

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

plexus08:05:51

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-stuttaford08:05:14

haha all good, i'll try it out

dominicm11:05:09

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

plexus13:05:17

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

🔨 8
🎉 4
plexus13:05:48

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

plexus13:05:01

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.

plexus13:05:27

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

😅 4
👏 4
felipebarros13:05:23

Feedbacks on the UI are appreciated as well!

Drew Verlee21:05:21

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 🙂