Fork me on GitHub
#calva
<
2024-03-01
>
yubrshen17:03:32

When executing a test of Clojure in VS Code with Calva and VS Code's test runner, I got the following error:

clj꞉snmp-trap-processing.test꞉> ;
Running tests for the following namespaces: ; 
snmp-trap-processing.test ; 
TypeError: Cannot read properties of undefined (reading 'results') 
I'm using the REPL of Babashka in Calva. I did got some warning that some lein error or warning, when starting VS Code with my babashka project with Calva. I asked github copilot, it told me that it might be an error of Javascript or my test setup. How to fix it?

pez17:03:59

At least part of it is something with Calva not handling undefined as it should. But why it happens there for you, I don’t know. The Leiningen error probably stems from that there’s a project.clj file there and clojure-lsp tries to execute it. It shouldn’t be causing the test runner problems, but you could try moving the project.clj file out of the way and reload the VS Code window, and see if that makes a difference.

yubrshen17:03:30

Thanks for the pointer. After moving out project.clj, there is no more complain related to lein. Because Calva uses cider-nrepl, whoes test-runner does not support testing Babashka, can I conclude that Calva's test commands will not work with Babashka REPL?

pez18:03:25

I’m afraid so. Maybe we should consider implementing a test runner that isn’t dependent on cider-nrepl…

🙏 1
pez19:03:32

You can get pretty far by just creating a custom repl command that runs test. The Calva test runner doesn’t do all that much beyond that.