Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.build by
recategorized by

Specifically I'd like to set clojure.test/*load-tests* to false, so that test code is excluded by the clojure.test/deftest,with-test etc. macro's. Lein provided injections as an escape hatch, tools.build doesn't seem to have an equivalent.

Looking at the code, tools.build seems to compile code from a separate generated script in a temp file, which seems to make injections or wrappers impossible. Also couldn't find options to pass other than compiler options.

A more in-depth description of this use case can be found on clojureverse: https://clojureverse.org/t/require-import-inside-deftest/8644/3

Is there a solution or suggested workaround available?

1 Answer

0 votes
selected by
Best answer

Right, tools.build forks a new process to do the compilation and creates the compilation code, so there currently is no way to do this. But, might be something worth exploring and I made a ticket at https://clojure.atlassian.net/browse/TBUILD-28 (I would particularly interesting in finding a broader set of use cases before working on it though).

I think my best suggestion for a workaround is to not intertwine your tests with your code so you don't need to do this.