Fork me on GitHub
#cursive
<
2019-10-28
>
nmkip00:10:12

Can someone help me setup intellij to run tests?

nmkip01:10:25

I couldn't find the "run tests in current NS in REPL" option

nmkip01:10:41

I'm currently running them using clj -Atest:runner

nmkip01:10:49

in a terminal

salam01:10:58

yeah, that's another way of running tests. in fact, if you haven't tried it yet, i highly recommend https://github.com/lambdaisland/kaocha

nmkip01:10:02

Thanks 🙂 I'll check it

salam01:10:06

as for "Run tests in current NS in REPL", it's avaiable only when a cursive repl is running (as with any other cursive context menu items.)

nmkip01:10:36

I have a running repl but not nREPL

nmkip01:10:23

I'm using REBL so in my repl run configuration I have the option clojure.main checked

salam01:10:17

ah, clojure.main repls don't support running clojure.test tests (yet)...

nmkip01:10:49

Can I have both REPLs at the same time?

salam02:10:14

i can't see why not even tough i've not tried myself. it guess, it's just a matter of running multiple repls in multiple tabs.

salam02:10:50

i use nrepl with deps.edn and here's what my alias looks like in my deps.edn:

:aliases {:cider {:extra-deps {cider/cider-nrepl {:mvn/version "0.22.4"}}
                   :main-opts ["--main" "nrepl.cmdline"
                               "--middleware" "[cider.nrepl/cider-middleware]"]}
and on the command line i can start a nrepl with: clojure -A:cider and have cursive connect to it.

salam02:10:11

you may also have cursive start a "local" nrepl using that alias, works pretty well.

nmkip02:10:50

If I run a repl with nREPL option I can run the tests through cursive

nmkip02:10:22

Ok, I can have both repls up

salam02:10:32

nice, good to know

nmkip02:10:44

Now I need a shortcut to run the tests 😛

salam02:10:49

my key bindings on macos (just for reference): Run a single test (under caret): Ctrl + Shift + ; Rerun Last Test: Ctrl + ; Run All Tests in NS: Ctrl + Alt + ;

nmkip02:10:42

Thanks for the reference 😄 I will add keybidings to those actions

onetom15:10:33

I'm just using cmd-shift-a "test" in a repl namespace and pick from the menu, either run all tests in current NS or just the one under the cursor, then i can re-run the latest test with cmd-r if i change the test or the implementation. It works from the implementation namespace too.

nmkip15:10:14

I added key bindings to the three testing actions

kenny16:10:46

Cursive isn't updating deps.edn dependencies for me anymore. After I click the refresh button, it will do "Reading projects" for a bit and then produce the 9:39 AM 'Deps: day8.re-frame/re-frame-10x:0.4.4' already disposed: --------------Creation trace: exception. This may have been happening in https://clojurians.slack.com/archives/C0744GXCJ/p1571418088107600 as well. I can notice it this time because I switched a dep from :git/url to :local/root and it isn't changing the classpath -- the dep is stuck on the git version.

cfleming22:10:09

Hmm, yeah, this must be related to the other errors you’re seeing. I’ll dig through those stacktraces and see what I can see.

kenny16:10:29

If I switch the REPL to "Run with Deps", I can at least get the dependency to become a local/root. Cursive won't resolve any new/added symbols from the local/root dep & doesn't do the nice auto-reload changed files for the dep (I need to manually to require :reload)

wilkerlucio17:10:05

@cfleming one question about the debugger, I notice when I add a breakpoint on some line, it seems to stop in that line more times than I expect, for example, I created a line that prints something out, when I run the fn, I see that print happening only once, but the debugger stops in the same line 3 times (when I hit play to keep running), is this expected?

cfleming22:10:09

Yes, that can happen. It’s because of macroexpansion - macros expand to a bunch of code that’s all marked as coming from the same line. I’ve been meaning to investigate how to make the debugger handle that but I haven’t gotten around to it.

cfleming22:10:16

@onetom I do something similar using Preferences | Appearance &amp; Behavior | Quick Lists. I have one called Testing which looks like this:

❤️ 8
cfleming22:10:48

Then I just bind a single easy shortcut to that (cmd-shift space) and invoke it, and then select the action I want:

tony.kay22:10:07

@cfleming The latest EAP, when using local/root in deps, does not auto-add the module…was that an intentional change?

cfleming23:10:41

@tony.kay Actually, it hasn’t done that since the new integration, but it’s on my list to fix.