Fork me on GitHub

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


<prefix>tc for "test current" by default


Should do it!


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


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:


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)


If, like me, you perfer to use clojure-expectations, , you may find this useful...


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


So that Conjure picks up defexpect to run tests


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.


I kind of like named tests at least sometimes.


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.


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.


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.


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


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


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


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.


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.


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.


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.


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.


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


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