Design patterns·The named ways it goes wrong
the test passed alone and failed in the suite, and the difference was something another test had left behind.
Global mutable state
Also calledthe singleton trap, global state, shared mutable global
State reachable from anywhere and writable by anyone, whether it is spelled as a global variable, a static field or a singleton. It makes execution order significant, makes tests interdependent, makes concurrency unsafe by default, and makes the dependency invisible in every signature. This is what people mean when they call the singleton an anti-pattern: the objection is almost never the instance count.