Fork me on GitHub
#calva
<
2020-03-09
>
mathieu.durand00:03:19

Hi everyone. I'm new to Calva and trying to create an efficient workflow. I have a shadow-cljs project, with some unit tests (using a :node-test target in shadow-cljs.edn) and it's running my tests fine. I'm, trying to see what Calva can do for unit testing, but when I connect to my running :node-test repl, and try to run namespace tests with Calva, I always get "No tests found". Same thing if I try to run a specific test. In addition to the no tests found message, I always see the following message: "No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.". My project is a NodeJS project, not a browser project. Any hint on what I'm doing wrong?

pez09:03:44

@mathieu.durand, welcome!

pez09:03:41

Calva can't run shadow-cljs tests, yet. I don't right now remember what is the problem, but it probably is something with how tests are discovered by cider-nrepl. What I do is that I have :auto-run true on the test target. See Calva's shadow-cljs.edn for an example: https://github.com/BetterThanTomorrow/calva/blob/c9320a00b3dce0dce1c107d6931c32396b72b9b9/shadow-cljs.edn#L25

pez09:03:16

Then when I jack in I tell Calva to start both builds, but I connect to the node library one and have the jack-in terminal visible as I work with the code.

pez09:03:50

As for the ”No application has connected” message... It's tricky without knowing more about your project config and how you start the app. Can you elaborate some?

conan19:03:50

Hi, my team uses CIDER, Cursive and (increasingly) Calva. I can't work out how to get a 2-space indent though, so all our PRs are full of whitespace changes. Here's what I'm after:

(defn add [x y]
  (+ x y)) ;; perfect

(rf/reg-sub :sum-x-y
            (fn [db] (add (:x db) (:y db)))) ;; no, too far!
I can find lots of discussion about this kind of thing but so far not the answer, I would be super grateful if someone could point me in the right direction?

conan19:03:48

A way of always using 2-space indent for everything would be fine

pez19:03:11

Hi, @conan. This is currently not possible with Calva. There is a PR that is starting to add it, but it is sonewhat dormant. I have merged that PR into a branch and am trying to find time for it. This branch: https://github.com/BetterThanTomorrow/calva/tree/wip/cljfmt-config If you have some time to look at it, I'd be happy to give you some pointers on where to dig.

conan19:03:35

Ah ok, thanks very much. I may have some time, do you think it would be a lot or a little work?

conan19:03:33

perhaps more importantly, is it typescript or clojurescript work?