> I'm talking about the code being tested having global state that is deeply entrenched in how it works
Could you give a specific/actual example of this? Technically a database is global state that is deeply entrenched in how an app works, but its trivial to make order independent tests that require certain records to exist.