Fork me on GitHub
#calva
<
2020-10-25
>
fadrian02:10:26

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.

borkdude10:10:08

it seems to be a windows only problem

manas_marthi15:10:38

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..

manas_marthi15:10:18

How do I evaluate these in repl from calva (expect ClassCastException (Integer. "99")) (expect ClassCastException (Integer. 99))

manas_marthi15:10:31

I am also getting evalCurrentFormInREPLWindow not found error

manas_marthi17:10:58

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)

pez17:10:59

What's wrong with the indentation?

bringe17:10:42

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?

pez17:10:44

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

bringe17:10:35

I've just tested jack-in with a clojure cli project, multi-project folder, and lein+figwheel on arch linux and all worked fine 🎉

pez17:10:11

Awesome. Thanks!

manas_marthi17:10:42

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))

manas_marthi17:10:12

(deftest manas-unit-tests
  (testing "Canary test"
    (is (= 1 1)))

manas_marthi17:10:28

This above test is running fine. When I use the expectations and run the run test under cursor it is not running

manas_marthi17:10:23

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

pez17:10:17

Yeah, those should be updated.

manas_marthi17:10:18

PS: I am using Calva via Windows subsystem for linux on Windows

manas_marthi17:10:13

Ctrl+Shift+p also is not working for some reason. It is adding curly braces

pez17:10:40

That's probably not Calva's doing though.

pez17:10:57

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.)

manas_marthi17:10:34

ok.. thank you. i'll go through that

manas_marthi17:10:15

What is the expected behaviour of "calva.loadFile", Does it recompile and reload the namespace?

manas_marthi17:10:14

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

manas_marthi17:10:28

Looks like the old deftest got retained in the namespace definitions

pez17:10:21

Yeah, I don't think it resets the namespace. See if the refresh namespace commands do that for you.

manas_marthi17:10:30

{
  "key": "",
  "command": "calva.refresh"
} /

pez17:10:33

As for tests, I'm thinking that maybe expect stuff is not seen by cider-nrepl. Are you using Midje?

manas_marthi17:10:43

Is that it? It does not seem to have any key associated with it

pez17:10:28

yeah, that's probably the one.

pez17:10:46

Assign a key to it if it seems to be what you need. 😃

pez17:10:31

There is also a refreshAll.

manas_marthi17:10:39

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

manas_marthi17:10:06

So canthe run tests in namespace not refresh the namespace like what midje is doing?

pez17:10:07

I think maybe the Calva (CIDER) test runner doesn't see Midje tests. Might work better with metosin/testit.

pez17:10:42

(I haven't tried it, but I see that testit uses deftest, so maybe, maybe.)

manas_marthi17:10:26

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

pez17:10:58

Cool. Let us know if you try testit, b/c I'm curious. 😃

manas_marthi17:10:08

I have one more doubt about executing commands on cursor and the placement of cursor on the next line

pez17:10:45

What's the doubt?

manas_marthi17:10:48

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

pez18:10:17

Didn't alt+enter work?

manas_marthi18:10:35

No. It is not working

manas_marthi18:10:56

Nothing happens when I hit alt+enter

manas_marthi18:10:11

Probably because I copied those commands from that gist?

pez18:10:22

Does it work using alt+enter in code files?

pez18:10:31

File an issue about it. It should work in the repl window as well.

pez18:10:23

The cursor is placed below the prompt on purpose, btw.

manas_marthi18:10:57

Okay. And alt+enter for expect does not show the output of the assertion. It shows the below output

manas_marthi18:10:36

How to clear the contents of the repl buffer?

pez18:10:20

Probably expect defines something. If you want to execute it, wrap in parens should work.

manas_marthi18:10:25

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=> 

pez18:10:00

The repl is mainly a regular file. Select all + delete clears it.

1
manas_marthi18:10:15

I assigned ctrl+, ctrl+r to calva refresh. It does not give any feedback message about the result of refresh

manas_marthi18:10:18

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..

pez19:10:19

Cool! We are here should you run into more issues.

❤️ 1
manas_marthi21:10:22

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..

bringe22:10:20

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.

calva 1