conjure

:neovim:+:clj: https://github.com/Olical/conjure - If you're enjoying Conjure and want to say thanks: https://github.com/users/Olical/sponsorship :smile: (alt https://conjure.fun/discord)
2021-03-01T15:24:33.016900Z

2021-03-01T19:33:48.018100Z

Is there a command to run a test using conjure? As in a single test defined by deftest.

2021-03-02T17:51:22.020900Z

I possible improvement would be eval the test form before running the test, I found surprising that it ran the version without changes of the test form.

Olical 2021-03-03T14:35:56.021100Z

I tried to avoid any sort of automatic eval since it could cause HUGE problems for people, it's in the realms of dangerous depending on what you're doing. Being able to run a test, then eval, then test again to see changes can be useful too.

Olical 2021-03-03T14:36:24.021300Z

There's no one solution that fits everyone for this sort of thing, so I try to go with the safer option then let users add custom mappings that do this sort of thing where required.

2021-03-03T14:38:27.021500Z

I understand the tradeoffs, maybe adding docs on how to create custom mappings composing commands would help.

Olical 2021-03-03T14:52:04.021700Z

Hmm, maybe, although that's kinda just normal vim things. Like nmap <localleader>G :ConjureLogResetSoft<cr>:ConjureEvalCurrentForm<cr> gives you a mapping that resets the log before each eval

Olical 2021-03-03T14:52:27.021900Z

There's nothing Conjure specific here, but I could maybe provide some examples? Or even a wiki page that people stick their interesting config in

2021-03-03T14:55:42.022100Z

Yeah, I think that would help. Usually there are many ways to do things in in vimland depending on what the plugin exposes and not every vim user knows how to customize things on their own.

Olical 2021-03-03T14:56:19.022300Z

I just realised the command to run the test under the cursor had an s on the end, making it sound like it ran many tests, not one. I've just fixed that on develop, so it'll be nmap <localleader>T :ConjureEvalRootForm<cr>:CljRunCurrentTest<cr> to get the behaviour you want, although you probably want to do this buffer local under a filetype autocmd.

2021-03-03T15:01:14.022600Z

Buffer local under a filetype autocmd is the sort of thing that I think could help people. I know that is not directly conjure related but it helps using conjure the way it should be used.

2021-03-03T15:04:04.022800Z

I learned almost everything I know about configuring vim by copying other people configs and then trying to understand how that works. Certainly not optimal but gets the job done. Nice examples help a lot for that.

Olical 2021-03-03T15:11:15.023Z

Yeah I get that, makes sense. I can try to find time to do some more general documentation like that, I'm just already kinda stretched to my breaking point with work/life/oss, so no promises I'm afraid. If people write up posts / wiki entries I'll gladly share them around, but I'm struggling to find time for myself at the moment.

2021-03-03T15:14:53.023500Z

Sure, I will try to help, answering questions here helps a lot, I'm really thankful for your work on conjure.

Olical 2021-03-03T15:35:11.024200Z

Any time people get to a question before me it brings a smile to my face 🙂 takes a weight off my mind. I've got a couple of weeks off soon so hopefully I can decompress my head a little then and work on a few more things around Conjure

Olical 2021-03-01T19:34:57.018300Z

<prefix>tc for "test current" by default

Olical 2021-03-01T19:34:59.018500Z

Should do it!

2021-03-01T19:39:02.018700Z

Cool, thanks! Is there a mark version for that?

Olical 2021-03-01T19:44:54.018900Z

Nope, I'm afraid that's just eval at mark. You could set an eval at mark to call a specific form that executes your tests though. Or add your own mapping that goes to the mark, runs the test and hops back? I could look into adding a generic mapping for this but not sure how it'd fit in with the others :thinking_face:

2021-03-01T19:48:06.019100Z

I'm also wondering about that. So what I want is to be able to run an specific test after changing other parts of the code (same use as the eval at mark). But tests do not work in the same way and more setup is necessary. I would argue that it would be good for developer ergonomics even if this is not a general thing (I don't think that every command should have a eval at mark version)

dharrigan 2021-03-01T20:01:57.019300Z

If, like me, you perfer to use clojure-expectations, <https://github.com/clojure-expectations/clojure-test>, you may find this useful...

dharrigan 2021-03-01T20:01:59.019500Z

let g:conjure#client#clojure#nrepl#test#current_form_names = ['deftest', 'defexpect']

dharrigan 2021-03-01T20:02:18.019700Z

So that Conjure picks up defexpect to run tests

2021-03-01T20:09:43.019900Z

That is cool, I will add to my config. I have been years since I used expectations, currently I use a plain deftest and the nubank/matcher-combinators` library for useful machers.

2021-03-01T20:10:13.020100Z

I kind of like named tests at least sometimes.