I have a singleton in a swift project (yes, I know people don't like those but I'd appreciate if you can look past that for now).
I'm writing some unit tests that aren't testing that singleton but the functions that they're testing depend on the state of that singleton. The singleton is declared with a static let, and the constructor is private anyway so resetting it like that isn't an option.
I can set it up right if I'm running one unit test by just setting a variable the singleton reads from in the setUp() method, but the moment I try to run the tests for the module as a whole, it gets set up with the first setUp() that calls it, and then it doesn't get reinstantiated after that. So basically it's stuck in a state for the entire module, which doesn't make sense to me - I would have expected everything to get reset between tests.
Is there a way to force XCTest to reset the testspace to make sure this singleton gets reset every time a new test file is run, rather than when it moves to a new module?