Currently, the docstring of with-redefs
in CLJS reads:
cljs.core/with-redefs
([bindings & body])
Macro
binding => var-symbol temp-value-expr
Temporarily redefines vars while executing the body. The
temp-value-exprs will be evaluated and each resulting value will
replace in parallel the root value of its var. After the body is
executed, the root values of all the vars will be set back to their
old values. Useful for mocking out functions during testing.
It makes it seem as if it's perfectly fine to use it in a similar way you'd use the same macro in CLJ.
However, this comment by David Nolen says otherwise:
If you want something to be redefinable with with-redefs
in production you need to mark those vars ^:dynamic.