In my tests I use something like:
;; api.utils
(defn wrap-test-server [f]
(start-test-server)
(f)
(stop-test-server))
;; api.some-endpoint
(use-fixtures
:once
utils/wrap-test-server)
However, I have to duplicate the fixture setup code in every test module.
How can I setup a global fixture for all the tests?
Or even better, for a "package" so that tests in api.*
are wrapped with the start / stop fixture.
Note that in this case, I don't care about the wrapping "level". The following would both work:
;; Wrap around all the tests in the package:
(start-test-server)
(test-1)
...
(test-n)
(stop-test-server)
;; Wrap every test in the package:
(start-test-server)
(test-1)
(stop-test-server)
...
(start-test-server)
(test-n)
(stop-test-server)