There was a problem with the last few versions of the program that prevented jack-in. Downgrade to version 2.0.126 and it should be good again. I don't know whether or not this has been fixed yet.
it seems to be a windows only problem
hi all, can some one please advise how to run expectations in calva.. I am running _"command"_: "calva.runTestUnderCursor",
short cut, it does not seem to trigger expectations properly..
How do I evaluate these in repl from calva (expect ClassCastException (Integer. "99"))
(expect ClassCastException (Integer. 99))
I am also getting evalCurrentFormInREPLWindow
not found error
And how to fix broken indentation using calva
(facts "About `first-element` "
(fact "it normally returns the first-element 33"
(first-element [1 2 3] :default) => 1)
(first-element nil :default) => :default)
What's wrong with the indentation?
I don't know for certain that the test runner works with expectations (have not used expectations much, and never with the test runner). It depends I guess on whether cider-nrepl sees the tests. @manas.marthi If you can provide some repo code in an issue where tests are not found that would help.
evalCurrentFormInREPLWindow
is no longer a command. I think that was only with the old repl window. What causes this error for you?
Dear Calva-friends: I have found the error with jack-in regression on Windows. It's fixed in this VSIX. Can you windows users run with that and see that it works now? Also Mac and Linux users can test it to check that it doesn't break stuff there. (Jack in to some projects and it should just work as before). https://8470-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.130-827-fix-windows-jack-in-193b17e5.vsix
I've just tested jack-in with a clojure cli project, multi-project folder, and lein+figwheel on arch linux and all worked fine 🎉
Awesome. Thanks!
Hi @brandon.ringe, The tests are running, but the result of expectations are not being reported.. It is just compiling the form and not doing anything about it
I tried evaluating the form and evaluating the selection.
(expect ClassCastException (Integer. 99))
is not getting reported as a failure..
Hi @pez, I am hoping to remove extra leading spaces and blank lines like below
(facts "About `first-element` "
(fact "it normally returns the first-element 33"
(first-element [1 2 3] :default) => 1)
(first-element nil :default) => :default))
(deftest manas-unit-tests
(testing "Canary test"
(is (= 1 1)))
This above test is running fine. When I use the expectations and run the run test under cursor
it is not running
Hi @pez I copied the shortcuts from the link given under "Replace all Calva `ctrl+alt+...` key bindings with `ctrl+shift+...`," part of the wiki. It has that evalCurrentFormInREPLWindow
https://gist.github.com/PEZ/3fc22e015e0d33fb9b73074fd6abf292
Yeah, those should be updated.
PS: I am using Calva via Windows subsystem for linux on Windows
Ctrl+Shift+p
also is not working for some reason. It is adding curly braces
That's probably not Calva's doing though.
You need to configure the indentation to work to your taste: https://calva.io/formatting/#configuration (Though I don't think you can make it remove single blank lines.)
ok.. thank you. i'll go through that
What is the expected behaviour of "calva.loadFile", Does it recompile and reload the namespace?
I had two deftests
and then merged both into single deftest
the updated contents work when I run run test under cursor
. But old deftests were running when I ran run tests in the namespace
Looks like the old deftest got retained in the namespace definitions
Yeah, I don't think it resets the namespace. See if the refresh namespace commands do that for you.
{
"key": "",
"command": "calva.refresh"
} /
As for tests, I'm thinking that maybe expect
stuff is not seen by cider-nrepl
. Are you using Midje?
Is that it? It does not seem to have any key associated with it
yeah, that's probably the one.
Assign a key to it if it seems to be what you need. 😃
There is also a refreshAll
.
I am doing the examples in clojure workshop book by @viebel. The book uses lein expectations
to run expectations. But I was unable to run them from within the vscode. I then started using Midje. I had to run (autotest)
on the repl and the tests are running automatically. I am not running any (facts
individually
So canthe run tests in namespace
not refresh the namespace like what midje
is doing?
I think maybe the Calva (CIDER) test runner doesn't see Midje tests. Might work better with metosin/testit.
(I haven't tried it, but I see that testit uses deftest, so maybe, maybe.)
Okay, well for now, midje re running them all with updated sources, so I am okay now with what's going on with the tests
Cool. Let us know if you try testit, b/c I'm curious. 😃
I have one more doubt about executing commands on cursor and the placement of cursor on the next line
What's the doubt?
I tried (println 1)
and I had to hit ctrl+enter
to get it running. The cursor got placed in the line after the arrow in the next cursor
Didn't alt+enter
work?
No. It is not working
Nothing happens when I hit alt+enter
Probably because I copied those commands from that gist?
Does it work using alt+enter in code files?
yeah it does
File an issue about it. It should work in the repl window as well.
The cursor is placed below the prompt on purpose, btw.
Okay. And alt+enter for expect does not show the output of the assertion. It shows the below output
How to clear the contents of the repl buffer?
Probably expect
defines something. If you want to execute it, wrap in parens should work.
clj::cljworkshop.core-test=>
#'cljworkshop.core-test/expect-1861403530
clj::cljworkshop.core-test=>
1
nil
clj::cljworkshop.core-test=>
#'cljworkshop.core-test/expect-1861403530
clj::cljworkshop.core-test=>
The repl is mainly a regular file. Select all + delete clears it.
I assigned ctrl+, ctrl+r
to calva refresh
. It does not give any feedback message about the result of refresh
Done. https://github.com/BetterThanTomorrow/calva/issues/829
Ctrl+Alt+l
is doing the job I need. And Ctrl+A+Del
is clearing the buffer. I am good for now. Thank you very much for responding to my queries..
Cool! We are here should you run into more issues.
Thanks!
Sean advised that I should be using expectations/clojure-test
instead of classic expectations so that it works from file buffer.. I tried it. It is working fine . Thanks..
Calva version 2.0.130 is out now in the VS Code marketplace. Jack-in should now work on Windows again. If you're using the open source version of vs code - "Code - OSS" the latest version there is still 2.0.129. The publish to Open VSX just started failing so we'll need to fix that in the CI.