This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-20
Channels
- # announcements (1)
- # aws (4)
- # babashka (9)
- # beginners (89)
- # biff (5)
- # cider (36)
- # clj-kondo (12)
- # cljfx (4)
- # clojure (65)
- # clojure-europe (11)
- # clojure-norway (16)
- # clojure-uk (4)
- # clojurescript (25)
- # clr (2)
- # community-development (2)
- # cursive (8)
- # datomic (9)
- # emacs (8)
- # fulcro (63)
- # holy-lambda (18)
- # hyperfiddle (32)
- # introduce-yourself (1)
- # lsp (1)
- # off-topic (9)
- # pedestal (6)
- # ring (10)
- # ring-swagger (3)
- # squint (26)
- # xtdb (3)
- # yamlscript (71)
The latest MELPA (non-stable) version of CIDER brings many improvements to the Inspector. Most of them are not user-facing but rather target the stability and consistency of the UX.
• New customizable variable cider-inspector-max-nested-depth
(defaults to 5) limits the number of levels printed in a nested collection in the inspector, similar to *clojure.core/*print-depth*
. It also has an accompanying keybinding C
in the inspector window.
• Many small prettifications in the inspector are related to rendering Java classes, fields, and such.
• Evaluation results that are too long to be usefully presented to the user are now truncated earlier in the pipeline which greatly improves Emacs responsiveness. This applies to showing results in the minibuffer and stepping through large data structures in the debugger.
Note that CIDER has now dropped support for Clojure 1.9 and now targets Clojure 1.10 and onward. If you rely on that particular Clojure version, leave a comment. Please also share any possible breakages or changes that are significant to your workflow.
Normally I try to maximize clarity in communications as not everyone is familiar with melpa intricacies. For that matter, people keep re-discovering 'the bad way' (start the work day with a bug, etc) that most often what they want is to use Stable for most packages (or the equivalent Git tag)
Anyway, we have a stable release around the corner! In big part thanks to your awesome streak of contribs 🙌
Hi! I observed some surprising behavior. After installing https://github.com/magnars/kaocha-runner.el in my Emacs, M-x cider-test-run-project-tests
appears to run my unit tests twice (or more than twice).
I recorded a video of what I’m seeing. I believe the dark-green output on the bottom comes from CIDER, and the light-green output comes from kaocha-runner.el.
Is this a bug? Should I report anyhwere?
Nice
Maybe you have some extra setup code that bridges kaocha with cider? Like an advice-add
I don't see anything in https://github.com/magnars/kaocha-runner.el/blob/master/kaocha-runner.el that would do something 'magical', fortunately
Note: I’m on Doom Emacs, I should have included that piece of information. Doom may be doing something weird.
GNU Emacs v29.1 nil
Doom core v3.0.0-pre HEAD -> master 9620bb45 2024-04-18 14:20:48 -0400
Doom modules v24.04.0-pre HEAD -> master 9620bb45 2024-04-18 14:20:48 -0400
Within my Emacs config, this is all I’ve got:
Exported grep results:
config.el:194: (kaocha-runner-run-all-tests)
config.el:506:(use-package! kaocha-runner)
packages.el:56:(package! kaocha-runner)
I’ll look into Doom’s Clojure layer — good idea.It’s inside a function I use to run my tests from a REPL:
(defun teod-reload+test ()
(interactive)
(auto-revert-mode 1)
(projectile-save-project-buffers)
(cider-interactive-eval "(do (require 'clj-reload.core) (clj-reload.core/reload))")
(kaocha-runner-run-all-tests)
;; (cider-test-run-project-tests nil)
)
(map! :g "M-RET" #'teod-reload+test)
I can’t find find any references to kaocha from within the Doom Emacs mode for Clojure. I looked through the code, didn’t see anything that looked weird. https://github.com/doomemacs/doomemacs/tree/9620bb45ac4cd7b0274c497b2d9d93c4ad9364ee/modules/lang/clojure/
I ran out of ideas Maybe this scenario is familiar to @U07FCNURX?
Quick idea, M-x describe-function cider-test-run-project-tests
might reveal any present advice
I’m seeing this:
cider-test-run-project-tests is an interactive byte-compiled Lisp function in
'cider-test.el'.
(cider-test-run-project-tests PROMPT-FOR-FILTERS)
Run all tests defined in all project namespaces, loading these as needed.
If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to
filter the tests with.
does that mean no advice present?Yeah looks normal -- Another idea, maybe it's related to Kaocha itself? The JVM side, that is I'm not too familiar with it, but perhaps there's a watcher or hook, something like that
Perhaps — but then I’d have a hard time explaining why kaocha-runner.el-styled test output shows up in my Emacs!
Also, feel free to paste here the nrepl logs:
• restart emacs
• (setq nrepl-log-messages t)
• repro bug
• grab contents of *nrepl-messages-<repl name>*
Sorry, got distracted. I’ll try without using kaocha-runner.el and get the nrepl logs.
> Does it happen if you never used kaocha-runner.el in the current emacs session? No.
1. I do not observe a double test run when I’ve never loaded kaocha-runner
2. I do not observe a double test run when I’ve loaded kaocha-runner
but never used it
3. I do observe a double test run when I’ve run a kaocha-runner
test run first (`M-x kaocha-runner-run-all-tests`), and then later run the tests with CIDER (`M-x cider-test-run-project-tests`)
NREPL logs attached. They are a bit longer than they could be, I had to mess around a bit in order to reproduce the double test run. I’ll try make a shorter one next.
Shorter reproduction. I did the following: 1. Turned on NREPL logs 2. Ran tests with kaocha-runner once 3. Ran tests with cider-test once
Thanks! I'll take a look later today
My theory is that Kaocha's cider-nrepl-request:eval
never completes (this is a usual characteristic of nrepl requests - they keep waiting for stdout indefinitely) and captures output triggered by later cider-test-run-project-tests
calls
Awesome! And thanks for CIDER; CIDER is still awesome. I’m happy try more things to reproduce if that’s helpful.

That is interesting. It's almost like asynchronous callback based code is hard to get right. 😅 I wonder why it never completes, tho. One solution would be to add a timeout, I guess, but that would only be treating symptoms.
Even adding a timeout is a problem, given I don't know how long your tests are supposed to run. From what I can tell judging by this thread, the different cider-nrepl-requests are receiving each others callbacks, is that right? In that case, how do other libs work around this issue?
This is not a fix, but it hopefully reduces the fallout somewhat: https://github.com/magnars/kaocha-runner.el/commit/1bcb19e2e2b169f05d61ef0420bedc283bcbc648