-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Los Angeles Meetup Thoughts: Moving from clojure.test to lazytest #5
Comments
My "solution" to this is to modify my test runners to look for both types of tests and run both My Polylith runner current looks for tests like this: https://github.com/seancorfield/polylith-external-test-runner/blob/main/bases/external-test-runner-cli/src/org/corfield/external_test_runner_cli/main.clj#L64-L70 Then it runs both and merges the result: https://github.com/seancorfield/polylith-external-test-runner/blob/main/bases/external-test-runner-cli/src/org/corfield/external_test_runner_cli/main.clj#L102-L106 And my Calva REPL snippets have been updated to run both on a per-namespace basis: https://github.com/seancorfield/vscode-calva-setup/blob/develop/calva/config.edn#L114-L143 |
For results displaying/checking: I did something similar when I moved Splint from A simple For actually transitioning the tests themselves, here's a couple different ideas:
Fundamentally tho, the switch is pretty one-to-one: This does highlight one small gap in Lazytest that I haven't found a good solution for. In clojure.test, you can write a simple deftest with a handful of assertions, but in Lazytest, you need to nest the assertions in an outer test case: (deftest example-test
(is (= 1 (one))
(is (= 2 (two))
(is (= 3 (three))))
; vs
(defdescribe example
(it "works"
(expect (= 1 (one))
(expect (= 2 (two))
(expect (= 3 (three))))) It's a small point of friction, but I'm not pleased with it at the moment. |
I would consider the necessary addition of something more descriptive as a "feature" not a "bug"! I like |
I tend to agree. I think i've felt this pain mostly because I wrote a lot of test files for splint that were named for the splint rule, then the only test was named for the rule, and then the single test case doc string was... what? the rule name again? for example: https://github.com/NoahTheDuke/splint/blob/main/test/noahtheduke/splint/rules/lint/let_if_test.clj I think that's a particularly weird scenario tho, and most usage will be better for the requirement. |
Maybe some of this could go into a "Migration" section in the README? And at some point, the README could link to runners that run both, once we have releases of them... |
As a follow-up note here, both my Polylith external test runner and my fork of Cognitect's
Both of those test runners can be used to deal with incremental migration from a pure |
From the slack channel:
The text was updated successfully, but these errors were encountered: