This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-07-05
Channels
- # announcements (12)
- # babashka (1)
- # beginners (119)
- # clj-commons (3)
- # clojure-conj (4)
- # clojure-europe (19)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-norway (8)
- # clojure-sweden (20)
- # clojure-uk (9)
- # clojurescript (10)
- # datahike (1)
- # datalevin (3)
- # datomic (18)
- # fulcro (8)
- # honeysql (16)
- # hoplon (3)
- # hyperfiddle (5)
- # lsp (6)
- # nextjournal (6)
- # off-topic (13)
- # pathom (12)
- # remote-jobs (5)
- # shadow-cljs (21)
- # testing (1)
- # tools-deps (10)
- # yamlscript (4)
Hello This is part of my shadow-cljs.edn file
{:builds
{:app
{:asset-path "/js/q",
...},
:tests {:ns-regexp "-test$", :output-to "out/tests.js", :target :karma}},
:dependencies [...],
:nrepl {...},
:source-paths ["src/cljs" "src/cljc" "src/clj" "test/cljs"]}
Is there a way I can have the tests output in different files e.g out/test1.js, out/test2.js?A JS file per namespace?
You can create multiple test builds, each with its own :output-to
and :ns-regexp
.
Or, if the tests will be run by some JS library/framework, you can probably use module splitting within a single build and export all the test functions.
Can it not make coverage report for each test function? Or would that be too granular?
:karma
only outputs a single file. :npm-module
has a file per namespace, but no clue how that works with karma
I'm having a bit of a hard time writing idiomatic code with promisified loop/recur, can someone nudge me in the right direction? (I do have this code wroking with regular promise chains just fine, I only wanted to see if I can make it "neater"). Here's the problem statement: I'm using promesa as my promise-handling library and I'm trying to figure if its loop/recur can recur over promises.
(defn myfn
[v]
(println "called myfn with " (str v))
(if (= v 0) (p/resolved "42!") (p/rejected "bleh")))
(defn err-handler
[e i]
(println "err: " (str e))
#_(p/then (p/delay 1000)
(do
(println "will recur")
(p/recur (dec i))))
(p/recur (dec i)))
(defn recur-myfn
[f]
(p/loop [i 3]
(p/do
(println "recur with " i)
(-> (f i)
(p/catch #(err-handler % i))))))
(recur-myfn myfn)
The code above works as intended, but if you use the commented out implementation in err-handler
, it breaks with a mysterious f.call is not a function
.
I tried going through the p/loop macro but my clojure skills aren't there yet so I'm getting lost. Overall I don't have to be concerned with the stack depth with the promises, it's just that it seemed that loop/recur code would signal my intent betterthanks! I'm still getting used to programming without types and I'm missing those subtle differences all over the place
that was totally it