Fork me on GitHub
#cider
<
2015-11-02
>
malabarba09:11:27

@pandeiro we're currently ironing out that duplication on the prompt And a variable will be added to avoid the prompt altogether.

malabarba11:11:11

@abtv: Are you using the snapshots?

abtv11:11:21

@malabarba: yes

malabarba11:11:13

Which of the two methods described in "ClojureScript usage" did you use?

malabarba11:11:18

The first or the second?

pandeiro13:11:50

Cheers @malabarba @bozhidar - I'm trying to work around it by using a wrapper function that calls cider-connect with the project root dir via projectile

twillis14:11:47

hello all, I'm new here, is there an equivalent to lein test in cider?

akiva14:11:24

@twillis: cider-test-run-tests.

malabarba14:11:37

Keep in mind you need to load the tests first

twillis14:11:54

that only runs them for the current namespace, lein test runs the whole test suite.

C-c , runs the command cider-test-run-tests, which is an interactive
compiled Lisp function in `cider-test.el'.

It is bound to C-c ,, <menu-bar> <CIDER> <Test> <Run all tests>.

(cider-test-run-tests SUPPRESS-INFERENCE)

Run all tests for the current Clojure source or test report context.

With a prefix arg SUPPRESS-INFERENCE it will try to run the tests in the
current ns.

malabarba14:11:37

@twillis: The docstring you quoted disagrees with what you said. simple_smile

twillis14:11:23

yeah you are right. but the behavior i'm seeing is it only runs the corresponding tests for whichever buffer i'm in.

twillis14:11:09

as if i'm running it with a prefix arg If i'm reading that doc string right

malabarba14:11:49

you're right, I get the same

malabarba14:11:00

@bozhidar: Is this intended?

twillis14:11:34

source confirms....

(defun cider-test-run-tests (suppress-inference)
  "Run all tests for the current Clojure source or test report context.

With a prefix arg SUPPRESS-INFERENCE it will try to run the tests in the
current ns."
  (interactive "P")
  (if-let ((ns (if suppress-inference
                   (clojure-find-ns)
                 (or (funcall cider-test-infer-test-ns (clojure-find-ns))
                     (when (eq major-mode 'cider-test-report-mode)
                       cider-test-last-test-ns)))))
      (cider-test-execute ns nil)
    (message "No namespace to test in current context")))

twillis15:11:12

I actually prefer the behavior the way it is, but I routinely run lein test like a good dev before I push, and was just curious if I could do the equivalent with cider, since it would make it easier to jump to problem areas. I guess if I run it in a compile buffer I get some of that back.

akiva15:11:32

I have my tests running automatically in the background on save so I’ve never used CIDER to do it.

twillis15:11:45

ideally one could just run M-x compile with lein test-refresh but the output doesnt get parsed right to make niceties like jumping to where the error occurred possible

malabarba15:11:02

I had some code to make compile play nice with lein

malabarba15:11:19

I'll try to look for it later

malabarba15:11:45

I planned on adding it directly to Emacs, but the compile.el code is... complicated

bozhidar15:11:25

there’s no way right now to run all the tests

bozhidar15:11:28

in the project

bozhidar15:11:43

I believe this was requested a few times, but we never got to implementing it

bozhidar15:11:55

there’s also something else to consider

bozhidar15:11:10

running the tests for all loaded namespaces would be fairly easy

bozhidar15:11:46

running the tests for all files in the project would require a somewhat different approach compared to the one we use now

malabarba15:11:36

I think all loaded namespaces would be a good start

malabarba15:11:31

besides, I think if the user has refactor-nrepl set up, then "loaded namespaces" ends up being equal to "all namespaces"

malabarba15:11:43

So there's an easy workaround for that limitation

twillis15:11:10

yeah I think C-u C-c C-x loads everything and it's in my muscle memory now

twillis16:11:42

my vote for keybinding is C-C < simple_smile

bozhidar16:11:41

I wouldn’t worry that much about the keybinding

bozhidar16:11:52

I’m more concerned about finding time to actually implement this

twillis16:11:21

you want me to put a bug in github? feature request style?

bozhidar16:11:42

feel free to add more comments here

twillis16:11:23

ah ok thanks much

abtv20:11:59

@malabarba: Sorry, I didn't mention your question

abtv20:11:12

I'm trying the first option

abtv20:11:41

>Issue M-x customize-variable RET cider-cljs-repl if you'd like to change the REPL used (the default is rhino).

abtv20:11:56

And it shows "no match"

abtv20:11:05

And if I run cider-jack-in-clojurescript it shows an error:

abtv20:11:12

>IllegalArgumentException No value supplied for key: [email protected] clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77)

abtv20:11:09

If I use the second option I can change cider-cljs-repl (I see alternatives there), but it also doesn't work