Fork me on GitHub
Marc O'Morain12:11:59

I’ve never manages to get Calva’s “Run Tests” to work - could someone help me debug what I’m doing wrong? I’m in a namespace that has 2 tests defined using clojure.test/deftest. And I run Calva Run Tests For Current Namespace:

Evaluating file: esxi_test.clj
=> #'circleci.vm-service.providers.esxi-test/it-handles-exceptions
Running namespace tests…

No tests found. 😱, ns: 0, vars: 0

Marc O'Morain12:11:44

Similarly, running all tests:

Running all project tests…

No tests found. 😱, ns: 0, vars: 0

Marc O'Morain12:11:02

I’m connected with leiningen / nREPL


I doubt you are doing something wrong, @marc-omorain. Rather what is Calva doing wrong here...

Marc O'Morain12:11:27

I wonder if I don’t have the correct Cider middleware.


Are you using jack-in or do you connect to a running repl?

Marc O'Morain12:11:46

“Connect to a running repl in the project” -> leiningen -> localhost -> it picks up the port automatically

Marc O'Morain12:11:12

So, this fails: (require 'cider.nrepl.middleware.test)

Marc O'Morain12:11:06

from when I was looking at reporting the tests to the test panel in VSCode before, I remember that there is an nrepl command to list the current installed middleware. It might be the case that I don’t have the required nrepl middleware loaded, and that we could detect that better by listing the middleware and ensuring that the required ones are loaded


Is there a reason you do not use jack-in?

Marc O'Morain12:11:16

I don’t know what jack-in is 🙂


Bring down the command palette. Type jack-in. The name is really something else, like Start the Project ... or some such.

Marc O'Morain12:11:19

my service is running in docker using docker-compose, and it exposes the nrepl port to localhost so that I can connect from VSCode. It looks like jack-in starts the project?




So seems there is a reason...


Trying out Calva. Im am jacked in, cursor is on a function in a .clj buffer. "Go to definition" says "No definition found for ...". Shouldn't that bring me to the definition of the function in the source?


@marc-omorain If you use jack-in to a local leiningen project, you will get the command line Calva would use to ensure it has the dependencies it needs.


@deas have you loaded the file?


@pez Just have the buffer open. Did not explicitely load it in the repl.


@pez Loading did the trick! Thanks.


Cool. We should try to hint that instead of showing no definition found...


We try to avoid loading code w/o the user's explicit action, b/c it can have quite severe effects. At the same time the dynamic way we find definitions demands that the code is loaded. Haha. But, to we can do better than just refuse to show definitions...

Marc O'Morain12:11:58

I’m running Calva in debug mode as described in the wiki, with the watcher running. If I change the Calva source code .ts files in the main VSCode Window, will the debug VSCode window load those changes? Or do I need to stop debugging and start debugging again to make the changes take effect?


Yeah, ts code do not hot-reload, unfortunately, that's only happening for the cljs code.

David Brear15:11:39

hey channel, if I let calva start the nrepl and then open up a cljs file the repl seems to only be looking for clj files. Has anyone seen an issue where cljs files are not even recognized?


I haven't seen that. How do you mean the repl only is looking for clj files?

David Brear19:11:26

so I am following these instructions: and it's starting an nrepl. In Calva, I go to "connect to a server in your project" and it fills in the port of the nrepl server but in the bottom next to the nREPL lightning bolt it only has clj

David Brear19:11:18

when I try to include a cljs file like lambda/core.cljs I do (require 'lambda.core) and it errors with could not find and files named lambda/core.clj

David Brear19:11:45

when I start the calva nrepl as well it does the same thing


Yeah. Calva only gives you a window into the the application, you’ll get the same errors. That is a good thing. 😃


To start with, I recommend you do not edit ~/.clojure/deps.edn, and instead let Calva start the project for you. It will then inject piggieback and such for you.


The command is *Calva: Start a Project REPL and connect*. See here:


Then it comes down to what kind of ClojureScript project you are trying with. You will need to know that when telling Calva to start the project. Calva supports Figwheel Main, shadow-cljs and lein-figwheel (which is called “Legacy Fighweel” in Calva to discourage using it).


If you are using Clojure CLI/tools.deps I recommend editing ~/.clojure/deps.edn like is described here:

David Brear19:11:44

oh actually now that you mention that there was a change recently to bring figwheel back in. I'll give that a shot. thanks in advance


If you are just trying things out I recommend the Figwheel Main template:

David Brear19:11:42

I think our issue is it is trying to start up a repl in the environment that i'm trying to connect to the nrepl in. I went back and tried with Clojure CLI + Figwheel Main and it's now just hanging on the "Jacking in..." phase


How long has it been hanging?


What do you have in the Jack-in Terminal?


If you have a REPL running from earlier tries you should probably kill that one first. Then jack-in from Calva.

David Brear19:11:58

so it looks like it started a repl in the terminal...

David Brear19:11:04

> Executing task: clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/cider-nrepl {:mvn/version "0.22.4"} cider/piggieback {:mvn/version "0.4.1"} com.bhauman/figwheel-main {:mvn/version "0.2.3"}}}' -A:dev <

2019-11-15 14:52:58.735:INFO::main: Logging initialized @4924ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Compiling build dev to "target/node/dev/dev-main.js"
[Figwheel] Successfully compiled build dev to "target/node/dev/dev-main.js" in 5.161 seconds.
[Figwheel] Watching paths: ("src") to compile build - dev
[Figwheel] Starting Server at 
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. Node)
Figwheel Main Controls:
          (figwheel.main/stop-builds id ...)  ;; stops Figwheel autobuilder for ids
          (figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
          (figwheel.main/reset)               ;; stops, cleans, reloads config, and starts autobuilder
          (figwheel.main/build-once id ...)   ;; builds source one time
          (figwheel.main/clean id ...)        ;; deletes compiled cljs target files
          (figwheel.main/status)              ;; displays current state of system
Figwheel REPL Controls:
          (figwheel.repl/conns)               ;; displays the current connections
          (figwheel.repl/focus session-name)  ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
    Docs: (doc function-name-here)
    Exit: :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
[Rebel readline] Type :repl/help for online help info
Starting node ... 
Node output being logged to: target/node/dev/node.log
For a better development experience:
  1. Open  ... (in Chrome)
  2. Click "Open dedicated DevTools for Node"
ClojureScript 1.10.520

David Brear19:11:48

in deps.edn we have this:

:dev {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}}
                 :main-opts ["--main" "figwheel.main"  "-t" "node" "--build" "dev" "--repl"]}


I see. Maybe you choose the wrong alias. Let me try with a fresh template and I will be able to tell you what you should choose at the prompts.


OK. You shouldn’t use that profile then. Give me a sec, I’ll try myself here first so that I am not misleading you.

David Brear19:11:18

okay awesome, thanks so much


So start with no alias and with the dev profile.

David Brear20:11:39

I'm gonna run to a 1:1 with my manager but I'll b right back


Cool. Hope it will be a nice 1:1. 😃


When Calva asks which builds to start, choose booth dev and test. Then choose to connect to dev.


It’s all a bit confusing with profiles, aliases and builds…

David Brear20:11:26

so dev is a profile and we were just using it as an alias as well?

David Brear20:11:30

sorry about the delay


Maybe aliases on tools.deps can be thought of as equivalents to profiles in Leiningen projects…. An alias in tools.deps is sort of an alternative way to instrument the runtime environment. It often contains a main argument. … But I am the wrong person to answer this, because I haven’t fully wrapped my head around it. But in any case, that :dev entry you added to your deps.edn is an alias and using it makes Calva step back and not add it’s own main arguments, So that particular alias will not work with Calva.


Also. I think the correct sequence to use is to choose no alias, then choose to start the dev and test builds. Then choose to connect to dev.

David Brear21:11:06

so I went back and created a new figwheel-main project, should that just work right out of the box with Calva starting it up?


It’s getting late here, so I’ll be abandoning you now. I recommend asking in the channel. Others will probably step in. Also the #beginners channel is awesome.


Yes, the new project should work out of the box if you do not tell Calva to use any aliases.

David Brear21:11:20

oh okay no worries. Thank you again for all your help. I'm playing around with a new figwheel and this is making a lot of sense

David Brear21:11:38

yep, that works wonderfully

David Brear21:11:46

you rock bud, thanks so much!


Keep at it. Figwheel is awesome and you will be rewarded. 😃


And you are entirely welcome, sir!


Dear Calva friends: A new version of Calva is out, v2.0.61. See for details, but most of it is about how Paredit behaves in the REPL window. We are sort of preparing for making the Paredit engine we use there be the Paredit engine we us in the editor as well. There are a couple of fixes to our Paredit and the Clojure parser bahind it still to do before we take that step.

calva 8