Fork me on GitHub
#sci
<
2023-05-26
>
Macroz08:05:35

Hey, what's a good way to expose clojure.test to SCI so that I can have some code that tests itself too?

borkdude08:05:11

Is this JVM or JS?

borkdude09:05:57

Are you producing a binary with SCI?

Macroz09:05:36

Yeah, uberjar with SCI that enables someone to write plugins, and hopefully test them also.

Macroz09:05:24

Not a binary as in CLI or native program.

borkdude09:05:22

You can look at babashka.impl.clojure.test and babashka.impl.test how it's integrated in babashka itself. All the calls to babashka.impl.common/ctx you can replace with sci.ctx-store/get-context Make sure you register your context with sci.ctx-store/reset-context!

borkdude09:05:55

I'd be good to have this in sci.configs: https://github.com/babashka/sci.configs There is a configuration available for cljs.test but not for JVM, but this could be factored out of babashka

Macroz09:05:36

Nice, I wasn't aware of such a page :)

Macroz09:05:45

Another "library" I had some hair-pulling moments with is clojure.tools.logging

borkdude09:05:13

this is also in babashka. so you can have a look at how it's done there too

borkdude09:05:38

feature-logging/babashka/impl/logging.clj

borkdude09:05:08

also welcome to extract into sci.configs

borkdude09:05:29

it's "complected" with the taoensso.timbre config there right now

Macroz09:05:03

Thanks, I'll have a look,

Macroz10:05:25

Hmm, so how are the macros from babashka.impl.clojure.test exposed to SCI? That's something I missed. The context is defined in there but not everything is added?

borkdude10:05:26

> You can look at babashka.impl.clojure.test and babashka.impl.test So those two namespaces together

👍 2