feat: skipDoubleRegistration configuration #356
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is the implementation for feature request #335
Use case :
Some times developer don't want to touch production code to write test cases.
Scenario :
Code was release to production but some test cases are not written due to some high priorities.
if developer want to write test cases after some time, Then some test mock implementations need to put in place of real implementations.
To do this developer need to add if-else cases in production code to place right dependencies for test environments.
I feel touching production code after release, just for writing extra test cases is not a good approach.
Currently get_it does not have a capability to skip registrations if already registered. it throws Argument Error
Here is the test case which throws Argument Error
This PR adds one boolean variable
skipDoubleRegistration
to get_it configuration to ignore registration silently.Here is the test case:
To understand more, i have implemented a real world use case in a sample git repo, look into source code
I am open to take feedback and happy to modify this PR to land this feature requirement into get_it package.