chlorine-clover

mschmele 2021-12-06T20:34:01.003200Z

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?

mschmele 2021-12-06T20:34:23.003700Z

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

seancorfield 2021-12-06T20:36:52.005400Z

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)

seancorfield 2021-12-06T20:40:18.006500Z

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.

seancorfield 2021-12-06T20:41:48.007800Z

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

mschmele 2021-12-06T20:43:24.008200Z

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

mschmele 2021-12-06T20:44:41.008500Z

I'll try digging some more. Thank you!

mauricio.szabo 2021-12-06T20:45:20.009100Z

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

mschmele 2021-12-06T20:45:39.009300Z

yup - one sec

mschmele 2021-12-06T20:47:17.009500Z

that appears to work as well

mschmele 2021-12-06T20:49:25.010300Z

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

mschmele 2021-12-06T20:51:43.011600Z

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.szabo 2021-12-06T20:54:45.014300Z

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

mschmele 2021-12-06T20:59:48.014600Z

my selection is the same for running them both ways

seancorfield 2021-12-06T21:46:18.015400Z

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

💡 1
seancorfield 2021-12-06T21:46:22.015600Z

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

seancorfield 2021-12-06T21:47:38.016200Z

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

seancorfield 2021-12-06T21:47:54.016600Z

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

seancorfield 2021-12-06T21:49:17.017500Z

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

seancorfield 2021-12-06T21:51:04.019400Z

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?

seancorfield 2021-12-06T21:54:01.019700Z

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

mschmele 2021-12-06T21:57:38.020500Z

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

mschmele 2021-12-06T21:58:09.020900Z

probably because it saves me typing up front, hah

mschmele 2021-12-06T22:00:09.022100Z

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

seancorfield 2021-12-06T22:00:27.022600Z

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

mschmele 2021-12-06T22:00:50.023800Z

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

seancorfield 2021-12-06T22:00:54.023900Z

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

mauricio.szabo 2021-12-06T22:00:56.024100Z

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

mauricio.szabo 2021-12-06T22:01:06.024500Z

If you do, it's probably a bug 😄

seancorfield 2021-12-06T22:01:23.024900Z

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

mauricio.szabo 2021-12-06T22:02:32.025900Z

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

seancorfield 2021-12-06T22:03:43.026800Z

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.

seancorfield 2021-12-06T22:04:07.027500Z

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