Fork me on GitHub

Can someone help me setup intellij to run tests?


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


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


in a terminal


yeah, that's another way of running tests. in fact, if you haven't tried it yet, i highly recommend


Thanks 🙂 I'll check it


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


I have a running repl but not nREPL


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


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


Can I have both REPLs at the same time?


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.


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.


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


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


Ok, I can have both repls up


nice, good to know


Now I need a shortcut to run the tests 😛


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 + ;


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


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.


I added key bindings to the three testing actions


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:' already disposed: --------------Creation trace: exception. This may have been happening in 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.


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.


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)


@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?


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.


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

❤️ 8

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


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


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