babel-plugin-rewire
babel-plugin-rewire copied to clipboard
Support for Reset All would be useful
I like to do a full Reset in the before method of my tests, to make sure that one test can't interfere with another. I've currently got to do this by individually resetting the methods that I might override in the test suite. It would be very useful to be able to do:
setup('Reset Dependencies', function() {
testSubject.__ResetAllDependencies__();
});
instead and have this iterate over all of the dependencies that could have been rewired.
Unless i missing something in the documentation, i think this would be really useful. +1 for this.
This would help a lot
https://github.com/speedskater/babel-plugin-rewire/issues/114
For anybody who might be as confused about this as I am...
Rewire 1.1.0 adds a global function __rewire_reset_all__()
for doing just that. I have used it like so:
afterEeach(function() {
__rewire_reset_all__();
});
However, if you look at the README on the main page of this repo, you won't find any documentation about that, because you'll see the master
branch, which isn't the one that contains 1.1.0 release. That lives in a separate version-1.1.0 branch. Like the 2.x branch, which is also separate from master. Seems that master
branch is for maintaining 1.0.0
release... but why maintain it when 1.1.0 is out? That remains a mystery for me.