Fork me on GitHub
#chlorine-clover
<
2021-12-06
>
mschmele20:12:01

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?

mschmele20:12:23

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

seancorfield20:12:52

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)

seancorfield20:12:18

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.

seancorfield20:12:48

(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?)

mschmele20:12:24

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

mschmele20:12:41

I'll try digging some more. Thank you!

mauricio.szabo20:12:20

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

mschmele20:12:39

yup - one sec

mschmele20:12:17

that appears to work as well

mschmele20:12:25

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

mschmele20:12:43

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

mauricio.szabo20:12:45

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

mschmele20:12:48

my selection is the same for running them both ways

seancorfield21:12:18

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

💡 1
seancorfield21:12:22

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

seancorfield21:12:38

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

seancorfield21:12:54

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

seancorfield21:12:17

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

seancorfield21:12:04

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?

seancorfield21:12:01

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

mschmele21:12:38

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

mschmele21:12:09

probably because it saves me typing up front, hah

mschmele22:12:09

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

seancorfield22:12:27

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

mschmele22:12:50

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

seancorfield22:12:54

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

mauricio.szabo22:12:56

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

mauricio.szabo22:12:06

If you do, it's probably a bug 😄

seancorfield22:12:23

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

mauricio.szabo22:12:32

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

seancorfield22:12:43

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.

seancorfield22:12:07

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