calva

itaied 2025-10-10T08:24:33.101969Z

hey all i'm using calva for my cljs (shadow-cljs) project i have a running repl that is connected to the browser app how can i run tests? can i use the same repl? when i execute calva: run tests for current namespace i get

; Running tests for the following namespaces:
;   my-app-test
;   my-app

; No tests found. 😱, ns: 0, vars: 0
but when i execute (run-tests) it works from the same namespace
; 
; Testing my-app-test
; 
; Ran 1 tests containing 4 assertions.
; 0 failures, 0 errors.

pez 2025-10-10T08:56:51.737309Z

Hi! Iirc the Calva test runner does not support ClojureScript, because cider-nrepl doesn’t support it yet. This is very unclear in the Calva UI. What I do is: 1. I use shadow-cljs test runner on auto-run, so every time it reloads code, it also runs tests. 2. I have custom repl commands for running tests. So I run individual tests and tests for a namespace using these custom repl commands. Here are some custom commands I have defined:

"calva.customREPLCommandSnippets": [
    ...
    {
      "name": "Call Top Level Defined Symbol",
      "snippet": "($top-level-defined-symbol)"
    },
    {
      "name": "Run tests",
      "key": "r",
      "repl": "cljs",
      "snippet": "(require 'clojure.test) (clojure.test/run-tests)"
    },
    {
      "name": "Run all tests",
      "key": "t",
      "repl": "cljs",
      "snippet": "(require 'clojure.test) (clojure.test/run-all-tests)"
    },
    ...
  ],

itaied 2025-10-10T09:01:41.960929Z

oh got it thank you!

pez 2025-10-10T09:05:58.784429Z

I really like the shadow-cljs test runner. Here’s a config with the test runner enabled: https://github.com/anteoas/replicant-todomvc/blob/main/shadow-cljs.edn

itaied 2025-10-10T09:22:44.122019Z

i'm using the runner but without autorun

itaied 2025-10-10T09:23:50.421849Z

and target "karma" instead of node-test

pez 2025-10-10T09:29:28.913319Z

I use karma in some projects too, but lately I have started relying more on node-tests. For that todomvc example all tests can run in the JVM too, yet has almost full test coverage of the UI.