Redefining State Within a Test, gives you an easy way to redefine all state; however,
adding signal, removing noise
with-redefsonly help you if you redefine all of the affected state. The situation is even more problematic due to the fact that accidental state alteration often doesn't cause issues until a completely unrelated test suddenly fails. After being bitten by this issue a few times, I added the ability to warn when global state is modified by a test.
(expectations/warn-on-iref-updates)anywhere, expectations will provide you with a warning whenever any global state is altered.
:before-runhook described in this section. There's an example
expectations_options.cljin the expectations codebase that shows all of the code you need to enable this feature. Simply add this file or add the function to your existing file and you should see a warning on any global state alteration. If you're not sure where to put this file, refer to this section.
WARNING: success.success-examples:280 modified #'success.success-examples-src/an-atom from "atom" to "another atom"The warning should let you know which test is doing an unexpected modification, and the to and from values should give you an idea of where in the source the alteration is occurring.