You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First all all thank you for your great plugin. It already helps a lot 🚀!
One thing, that I'm missing is a "global" restore. Currently after each rewire import/call I need to "clean up" afterwards by explicitly calling restore for that es6 class. If one forgets to do so, the rewire will also be used in the next spec. If one uses mocks a lot this can be cumbersome.
I'm thinking of something like this in setup.js of a jasmine test:
Inside injector.rewire() method essentially calls foo.rewire() function (notice that it's imported as a namespace) and restore() calls foo.restore(). It keeps track of all the rewired modules and is essentially equivalent to what you're proposing. That would be very hard to do on the plugin level though, so I'd rather leave it to user-space.
I could share a basic implementation in a gist if you're interested.
First all all thank you for your great plugin. It already helps a lot 🚀!
One thing, that I'm missing is a "global" restore. Currently after each
rewire
import/call I need to "clean up" afterwards by explicitly callingrestore
for that es6 class. If one forgets to do so, the rewire will also be used in the next spec. If one uses mocks a lot this can be cumbersome.I'm thinking of something like this in
setup.js
of a jasmine test:restoreAll()
should restore all rewrites in all es6 modules used during the tests.The text was updated successfully, but these errors were encountered: