polylith

Zach 2024-10-04T09:39:44.500749Z

Hi everyone, anyone using polylith + emacs/cider? I'm curious how people run tests. I'm currently running them from a shell via poly test but feel like there should be a quicker way.

2024-10-06T01:17:34.507849Z

I use cider’s support for running tests

Patrix 2024-10-07T11:40:27.812549Z

As long as you include the :test alias when launching Cider, it should work with cider's built-in test support (`cider-run-project-tests` etc) (in emacs -- https://clojurians.slack.com/archives/C013B7MQHJQ/p1725449800690879 as in this earlier thread!)

Zach 2024-10-07T15:49:54.046419Z

Thanks @jasonjckn for confirming it’s a valid workflow and @patrix for flagging you need the test alias. Sounds like the root cause is me not setting up cider correctly. If I may ask, when you run tests do you run them via cider/repl? I’ve found running via cli is best because it’s consistent. When running from cider/repl, get errors that tests don’t exists (can’t find is) if I don’t manually load them which is a pain.

2024-10-07T19:53:35.349929Z

Nothing beats cider for running just a single test , i'll move my cursor to the test i want to run and hit , t t in doom emacs If i'm running the entire test suite i'll use polylith cli, if i'm running a namespace test suite, i'll flip between cider & cli --focus , just whatever happens to be more convenient at the time. Also there's cider-auto-test-mode which i don't enable that by default via cider-mode-hook, but i'll enable that mode sometimes depending on what i'm doing. There's a couple runtime differences between the two, for example, in cider, if you delete the test code, and you rerun the namespace tests, that function is still defined in the REPL environment, so you'll have a 'phantom' unit test with no code, but if you use tools.namespace refresh or clj-reload, that can help with that scenario. You should be able to get both environments to match for the most part. Obviously polylith test is much more exhaustive because it enumerates through every project/ possible classpath, and you can't approximate that in cider.

Patrix 2024-10-07T21:02:55.401359Z

Right, I also use Doom Emacs so it might be specific to Doom as well that all tests are loaded when including the :test alias