Does nbb work with cljc files?
For a static site, there's a script to transform the root hiccup file to a public/index.html file. The asset function is used to synchronously copy and generate a file name hash for uses like (asset "/img/logo.svg'). The client-side app though is built with shadow, and was thinking of creating a similar asset macro that uses Java to do the same thing. While it would work, it does mean duplicating the logic between JS and Java. In theory, could make it a bit better creating a single cljc file with some conditionals but not sure if that's feasible
Yes
I have added camel-snake-kebab to nbb.edn and it barfs like this
$ npx nbb
Downloading dependencies...
Extracting dependencies...
Done.
Welcome to nbb v1.0.136!
user=> (require '[camel-snake-kebab.core :as csk])
"#error {:message \"Could not resolve symbol: defconversion\", :data {:type :sci/error, :line 49, :column 1, :message \"Could not resolve symbol: defconversion\", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 49, :column 1, :ns #object[Oq camel-snake-kebab.core], :file \"/home/ray/qqq/.nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps/camel_snake_kebab/core.cljc\"})}], :file \"/home/ray/qqq/.nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps/camel_snake_kebab/core.cljc\", :phase \"analysis\"}, :cause #error {:message \"Could not resolve symbol: defconversion\", :data {:type :sci/error, :line nil, :column nil, :file \"/home/ray/qqq/.nbb/.cache/e4754d38932a5ba3dcbfe8a138680e6ec55900db/nbb-deps/camel_snake_kebab/core.cljc\", :phase \"analysis\"}}}"
user=> it claims compatibility with bb on the README but I guess there is more to do for nbb? What can I advise the project?
@raymcdermott The issue is the loading of the macro: https://github.com/clj-commons/camel-snake-kebab/blob/ac08444c94aca4cba25d86f3b3faf36596809380/src/camel_snake_kebab/core.cljc#L6 Perhaps nbb should just load the .clj macro namespace there
oh it's .cljc, hmm, yeah, something to look into. can you make an issue perhaps? Can look later this week hopefully
#nbb: scripting for Clojure on Node.js
1.0.139
• https://github.com/babashka/nbb/issues/268: Fix :require-macros (compatibility with https://github.com/clj-commons/camel-snake-kebab)
• https://github.com/babashka/nbb/issues/264: make load-file auto-await
cc @raymcdermott
works for me 🙂
What is the idiomatic way to execute some logic when a clojure.test/is assertion fails? For example, if https://github.com/babashka/nbb/blob/main/examples/playwright/example.cljs#L38 were a failing assertion, I would want to execute "test failed" logic e.g. taking a screenshot of the .page at that time
Playwright throws exceptions when one of its commands fail, so those exceptions can be caught through a single catch handler. Is there a catch-equivalent for failed assertions?