thiagobustamante / typescript-ioc

A Lightweight annotation-based dependency injection container for typescript.
MIT License
526 stars 64 forks source link

Allow for removing/reverting bindings #17

Closed westinpigott closed 6 years ago

westinpigott commented 7 years ago

When running unit tests, I force the binding for an interface to point to a mock implementation of it. (I override the normal annotation bindings.) Other test suites, should use the default bindings. The result is that the tests in the later suites are failing when run as a batch, but run fine when only the specific suite is run. Is there a way to reset the bindings back to the way they were? My thought is: 1) in before, we grab the existing configurations that we are about to override.
2) Run the tests 3) in after, put the configurations back.

Unfortunately, there is no way to get the current configuration, only the actual instance to determine what was originally set there.

thiagobustamante commented 6 years ago

@westinpigott ,

Thanks for the contribution. You PR is merged and it is part of release 1.1.0.