Add ability to invalidate require cache on rewired file
While running these tests, I'm trying to clear the require cache for every test to try to 'sandbox' things and not things set outside the export interfere when they're in a different state.
I would like a way to be able to force invalidate the cache when trying to rewire. Currently I have a workaround of deleting it manually before the test starts, but I think it would be neat if I could simply do rewire('./file', true) to force it to invalidate and get the new rewired file. I've modified it on my fork showing what I mean which could be cleaned up or adding at a better place.
Rewire will always return a new instance of the module. See the Caveats section in the readme.
@JvJefke but sub-dependencies aren't, which kinds of defeat the purpose.