Is there a way for the built in way of running the test under caret not load the current namespace? It looks like loading the current namespace is slower than just selecting the whole file and send that to the REPL.
that sounds very fishy... u can always use the little REPL input pane below the REPL output pane to just run your test function or let the test framework u r using to run it for you. i personally defined a Cursive REPL Command and bound that to a key: https://clojurians.slack.com/archives/C0744GXCJ/p1677794680000109?thread_ts=1677747617.855779&cid=C0744GXCJ in your custom REPL command definition u can choose not to load anything before evaluating whatever expression you want.
sounds like u must be doing some side-effect-ful operations during the loading of some of your namespaces, which your test namespace depends on
btw, my current REPL command expression has some timing added to it, since i shared that screenshot above:
(do (when-not (resolve 'user/focused-test) (intern 'user 'focused-test (atom nil)))
(when (:test (meta #'~current-var)) (reset! user/focused-test '~current-var))
(let [run (requiring-resolve 'kaocha.repl/run)]
(if-let [t @user/focused-test]
(do (require (symbol (namespace t)) :reload)
(time (run t)))
(time (run :unit :behaviour {})))))Thanks. Yeah, that's what I do usually, but I want to reduce my personal setup to a minimum to share it more widely with others that might be newer. From this, looks like it is reloading the namespaces my current ns depends on, given that just evaluating in the REPL is faster. If it's expected for the built in way to run test to be slow, and nothing to do about it, I can go on with the custom command approach.
> that sounds very fishy... What does? Not reloading the namespace?
the fact that "loading a namespace" takes longer than evaling its content
Yeah. Any ideas how to find out why?
if u could do a quick screen share i could help, but im busy at the moment unfortunately.
is it a local or remote repl connection you are talking about? because depending on that, loading a namespace is not the same as evaling the source code in your editor window.
> if u could do a quick screen share i could help I'm not sure I can, sorry. I can try out later with a dummy project I can share, although it might end up not having that difference... > is it a local or remote repl connection you are talking about? Local, just used the normal nrepl flow that's setup by default.
if you do a (time (require 'your.slow.name-space-test :reload :verbose)), is that slow too?
No, takes ~200ms. The load file takes more than a second
what action do u refer to, when u say "load file"?
the one bound to Cmd-Shift-L on macOS?
Yes, precisely
When I navigate to a namespace with the Plugins / Cursive / Namespace... action, the Project tool window opens up automatically, so I keep have to close it down with Cmd-1.
How do I disable this behaviour?
Is this some IntelliJ setting?
actually, it seems to only happen, when i confirm the selected namespace with Shift-Enter, to open it in a split.