Fork me on GitHub
#boot
<
2018-08-20
>
witek11:08:05

Hello. I would like to activate asserts and spec-asserts when running tests. Is there a way to put this activations into my build.boot instead of my source files? Or how to activate these assertions during tests but not in production? Thank you.

leblowl02:08:21

I am pretty sure you can run most code in your build.boot file, but I haven't used boot for a while. Do you know what test runner you are using? I would activate those asserts before you run the tests. I would put them anywhere you can inject code before test code is run, which varies based on how you run the tests. I am using circleci.test (https://github.com/circleci/circleci.test) with Leiningen to run tests and circleci.test has a global fixture that can run code before and after any tests are run. In my code I would probably activate the asserts in that fixture.

leblowl02:08:01

In boot you may just be able to add it to your test task at the top of the task definition

leblowl02:08:44

If you use a test task from another library, then you may be able to add a test task to your own built.boot file, activate your assertions and then call the actual test task from that other library