cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
zackteo 2021-01-14T05:39:46.001400Z

Does anyone know what might be causing me to get a popup of Lisp expression: in the minibuffer whenever I type something like ;; t? Been trying to isolate the problem, and it seems that it only happens after I start a cider session

Sergej Koščejev 2021-01-14T08:26:19.002700Z

(I asked this in #beginners but this channel might be better.) I have a deps.edn project with a single file looking like this:

(ns stuff)

(ns stuff-test (:require stuff) (:use clojure.test))

(with-test
  (defn sum [s]
    (+ s 2))
  (is (= 2 (sum 1))))
and I'm asking CIDER to run all tests in project. But it's telling me that there are no tests. What am I doing wrong?

Eamonn Sullivan 2021-01-14T08:35:20.002800Z

Did you evaluate the tests? On my keymap, that's C-c, C-k, but I think it's cider-eval-buffer or something like that.

solf 2021-01-14T09:06:00.003Z

With C-c C-k it does work. If you run all project tests it doesn indeed say no tests found

solf 2021-01-14T09:06:54.003300Z

My intuition is that there might be some hardcoded logic linked to run tests in project that tries to find namespaces in a test directory

Sergej Koščejev 2021-01-14T09:08:40.003500Z

C-c C-k is cider-load-buffer in my keymap, it just loads the thing but doesn't run any tests (the test should fail)

Eamonn Sullivan 2021-01-14T09:08:46.003700Z

:man-shrugging: Yeah, I haven't been able to get cider to run all the project's tests, but I use deps.edn on all of mine and I thought that would be why. I just have cider run the tests for the file I'm working on (which does work, after being eval'd) and run all tests in a terminal window.

solf 2021-01-14T09:11:43.003900Z

hmm I might have found out why, but not sure yet

solf 2021-01-14T09:11:57.004100Z

it works if you re-order the file as follows:

(ns stuff-test (:require stuff) (:use clojure.test))
(with-test
  (defn sum [s]
    (+ s 2))
  (is (= 2 (sum 1))))

(ns stuff)

solf 2021-01-14T09:14:06.004300Z

It might be something related to this: https://docs.cider.mx/cider/1.0/testing/running_tests.html#test-namespace-naming-convention

Sergej Koščejev 2021-01-14T09:21:28.004500Z

thanks, it didn't work at first but then I restarted CIDER and it started working

solf 2021-01-14T09:23:16.004700Z

It's not really a solution because I don't know why it works after reordering 😅

solf 2021-01-14T09:23:35.004900Z

This is the code that actually runs the tests https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/test.clj#L315

bozhidar 2021-01-14T10:16:16.005200Z

There's no logic related to folder in which the tests are placed. Tests have some special metadata attached to them, and this is what CIDER is looking for to evaluate them.

bozhidar 2021-01-14T10:16:30.005400Z

But as usual - you have to evaluate the test definitions before you're able to run any tests.

bozhidar 2021-01-14T10:17:12.006100Z

Often people mention they are having problems with navigation to Java definitions. Seems we've finally found the root cause of the issue https://github.com/clojure-emacs/orchard/issues/103

bozhidar 2021-01-14T10:17:25.006500Z

If someone wants to help with this - be my guest.

Sergej Koščejev 2021-01-14T10:27:24.006600Z

I did evaluate them before trying to run them, but it still reported there being no tests.

Eamonn Sullivan 2021-01-14T10:30:16.006800Z

I vaguely remember being able to run all project tests in CIDER back when I used lein, but I've not successfully gotten this feature to work with tools.deps. I asked about this a while back and never got an answer. It's not a big deal (I typically just want to run the tests against the code I'm working on, and can run them all in a terminal), but it would be nice to have.

2021-01-14T13:50:04.008700Z

When I evaluate an expression with cider-eval-last-sexp that results in an exception, the exception opens in a buffer asynchronously. This has started to take a very long time - upwards of several tens of seconds. When the buffer opens, I've usually long since fixed the underlying problem, but the buffer steals focus of the cursor. Is this a known problem, or could it be something else in my setup that's causing this?

bozhidar 2021-01-15T09:33:50.024400Z

Most likely you're using an old version of cider-nrepl.

bozhidar 2021-01-15T09:35:13.024600Z

A bunch of people reported experienced this issue after I should down http://clojuredocs-export.netlify.com. Frankly, I didn't expect that something like this would happen, otherwise I would have handled the situation differently.

2021-01-18T05:06:06.036200Z

Ah, THANK YOU! 🙏

2021-01-18T05:06:35.036400Z

Was about to loose my mind there 😅 Upgraded things, and now it's back to awesome. Thanks for your hard work!

naomarik 2021-01-14T14:33:10.011300Z

can anyone point me to a starting point to investigate why running any of the cider-test commands is taking a long time to run tests and show a report? everything else is instant and running tests manually with test/run-tests is also instant. nothing else about my dev environment is lagging, and awhile back running tests via cider wasn't doing this.

naomarik 2021-01-14T20:32:11.012900Z

found the slowdown in cider-test-clear-highlights and cider-test-highlight-problems commenting those out makes everything perform instantly again

naomarik 2021-01-14T20:58:55.013800Z

digging deeper, cider-sync-request:info is taking 2 seconds. in nrepl-send-sync-request (nrepl-send-request) with: (op info ns user sym sah.core-test/zh) as the request parameter is taking 2.5 secs to get a response. i have no idea where to go from here

naomarik 2021-01-14T22:48:20.020300Z

Ooops I lied, you see the reason why I'm a projrammer is not because I want to be, but because I can get myself out of being stuck. I updated cider-nrepl from 0.25.2 to 0.25.6 and it's perfect now.

dpsutton 2021-01-14T22:49:48.020600Z

awesome! glad the issue has gone away

naomarik 2021-01-14T22:52:15.021400Z

as a benefit my cider-error stacktrace window pops up instantly now instead of lagging for 5 seconds... actually disabled it because it was driving me crazy

naomarik 2021-01-14T22:52:35.021800Z

i actually installed doom-emacs to see if it was my emacs config

dpsutton 2021-01-14T22:54:24.022600Z

how did you have an old version of cider-nrepl around?

naomarik 2021-01-14T22:59:43.023200Z

project is old, everything was working didn't think to update that