@kenny integrating with kaocha is the long term goal, yes, mainly because that way you'll get a command line interface. There's no ready made solution for that yet.
@dominicm I'll share an example client when I'm back at the computer
Cool. Have you hand rolled them all to date?
yeah, basically. I have some code I've been copying from project to project. All you need is a websocket and transit. The websocket namespace I've largely lifted from Figwheel (on the clojurescript side). On Clojure I use Java-WebSocket.
Client https://github.com/lambdaisland/funnel-client/blob/main/src/lambdaisland/funnel_client.cljs and example use: https://github.com/lambdaisland/funnel-client/blob/main/src/lambdaisland/funnel_client/examples/reload.cljs
I had this sitting on my hard drive already but hadn't pushed it yet.
haven't gotten around to making a reusable generic Clojure client yet...
but you can have a look at https://github.com/lambdaisland/kaocha-cljs2/blob/master/src/kaocha/cljs2/funnel_client.clj for inspiration
I'll probably add a clj client to funnel-client by the end of the month, before I do my monthly open source update post 🙂
Great, that's wonderful. I'll have a play.
I'm going to use it to see if I can create an enhanced cljs dev experience for editors. It's always tricky trying to do things like interpret the types once you're back at the editor or JVM, so pushing that into cljs makes sense.
cool! looking forward to see what you come up with.
I'm playing around with glogi, trying to figure out how to make it log my params as a string rather than a map... is this not what :closure-defines {lambdaisland.glogi.console.colorize "false"}
should do?
can you elaborate @ramblurr what your log statement looks like and what you want that to look like in your logs?
(log/info "The current value is " 2)
;; prints: [my.ns] {"The current value is " 2, :line 10}
Whereas I'd like to not print structured logs, but just plain strings:
[my.ns] The current value is 2
what would that look like in the logs?
then you don't want to use Glögi
(sorry the slack editor was giving me problems)
no worries, so to elaborate, Glögi does structured logging, that's what it's designed for. Doing plaintext/printf style formatting is out of its scope
fair enough!
I would look into using the goog.log stuff directly, it's not that hard
or you can still leverage some of the glögi helpers, like lambdaisland.glogi/set-levels
and glogi/logger
or adopt structured logging of course 🙂 I can only recommend it
I use structured logging most places, however in this case I need something that needs to only be read by humans.. its more of a status log than a real log file
So looking at the formatting macro at https://github.com/lambdaisland/glogi/blob/master/src/lambdaisland/glogi.clj#L3-L12
I'm having some trouble outputing the evaled forms of the keyvals.. I replaced the ~(-> keyvals-map ...
bit with ~(str/join " " (map str ~keyvals))
but this outputs the un-evaled exprs 😮
I'm not so great with macros
FYI, the README states: > Licensed under the term of the Mozilla Public License 2.0, see LICENSE. but LICENSE contains the eclipse public license
So Chui is only meant to be used during development, not on CI?
oh thanks! that should be MPL, I'll fix that
something like this perhaps?
(defn- log-expr [form level keyvals]
`(log ~(str *ns*) ~level (str ~@(interpose " " keyvals))))
When you do ~(str/join ...)
that str/join
will be evaluated at macro-expand time, which is not what you want here.
Chui does not currently offer an out of the box solution for headless operation, no.
Got it. So the way you'd use Chui would be to run it while working on your cljs and to use shadow-cljs to run the tests on the CI? The primary advantage it gives you is a UI for viewing your cljs tests?
With what is currently there, yes. Chui-ui is meant for interactive use in combination with shadow's reloading. There are several pieces to Chui, and only Chui-ui is tied to the browser. Chui is designed to form the base line for clojurescript test running, including from the CLI and on CI, but that is still WIP.
https://lambdaisland.com/blog/2020-06-05-open-source-update-may-2020
I see. When I read "test runner" I thought that meant something invoked on the command line.
it means something that runs your tests. There's the test library/framework that allows you to write your tests, and there's the test runner which finds the tests and runs them (possibly filtered, specific reporting, etc.)
Sure. I suppose that a runner that can only run tests via UI fits that definition haha. I've just always thought of the "base" form of a runner as the ability to run tests via cli. UIs are nice-to-haves on top of the CLI. I now see the misunderstanding. Thanks for the clarification 🙂