Fork me on GitHub

I've noticed that when I try to run tests with clover, they aren't able to be run if they're tagged with `^:integration`. They work when I remove that keyword, but this is a new-to-me codebase so I'll be running into the issue fairly frequently, I think. I'm using Sean's vscode/clover setup pasted above, and am using the built-in clover runner. Is there anything I can do besides just removing that tag when I want to run a given test?


The tests fail to run, with the following output in clover: (:meta 2 "s")


What about running them from a REPL, outside of the editor? Just require clojure.test and one of the test namespaces that you're having problems with and eval (clojure.test/run-tests 'that.namespace)


The "built-in Clover runner" is just clojure.test/run-tests and metadata on tests is ignored by that. So I think something else must be happening here.


(and I just tried the above in a scratch project and the tests marked ^:integration run as expected -- and also run via Clover -- so I suspect this is something peculiar to your codebase, perhaps in the fixtures?)


Yeah, I think you're right. Running via the repl as you suggested worked as expected


I'll try digging some more. Thank you!


@mschmele can you run the same command that you ran in the REPL inside Clover, and see if it still fails?


yup - one sec


that appears to work as well


okay that worked, both when I tried using the command palate and the ctrl-; x hotkey


When I try to run them individually it seems to work via command palate, but not via the ctrl-; t hotkey. It fails with this popup, and the (:meta 2 "s") output mentioned above


Oh, maybe your position/selection is over the metadata. That will make Clover detect ^:integration as the var you want to run, and that will not work. Try to select the var you want to run tests, or just keep the cursor over the var, and see if it works


my selection is the same for running them both ways


Ah! Yes, you can't run the current test via ctrl-; t if it has metadata.

💡 1

(p/let [block (editor/get-top-block)
          test-name (when (seq (:text block))
                      (clojure.string/replace (:text block)
                                              #"\(def[a-z]* ([^\s]*)[^]*"
          here  (editor/get-selection)]


That replace call isn't smart enough to know how to remove the metadata prior to the test name.


I didn't realize you were trying to run a specific test.


I don't remember what that [^]* is for at the end of the regex? I suspect it matches "everything" including newlines...


So I guess it needs an optional match for one or more metadata tags there... #"\(def[a-z]* (\^:[-a-z]* )* ([^\s]*)[^]*" and then "$2" is probably what it needs there?


Hmm, that's not quite right... just a sec...


Ahhh, yeah sorry if I wasn't being 100% clear - I have a bad habit of leaving details out that I just assume people will know


probably because it saves me typing up front, hah


That looks to be the culprit, though! It seems to not be an issue when running tests for an entire namespace, so at the very least I'm happy enough knowing that tests aren't being left out when I'm running a larger batch


OK, get the updated version of config.cljs from GitHub (and reload VS Code).


Wow you're fast! I was just about to say that I'll probably have time to try to issue a fix tomorrow


I just tested the updated version locally so I think it should be good to go now.


I think you don't need to reload VSCode to apply the latests versions from config.cljs


If you do, it's probably a bug 😄


@mauricio.szabo You don't need to reload Atom, but you do need to reload VS Code in my experience.


Then I'll look at it - seems like a bug (saving the file should work by unloading the latest custom commands and loading the new ones). I'll create an issue to track it


It's never worked automatically for me -- and I'm pretty sure you said early on that VS Code needed a reload? I just tried it and it definitely doesn't work for me.


(but it's rare that I modify config.cljs at this point so it's not a big deal)