fix(*): support same token to be injected twice#68
Merged
Conversation
Refactor the `DependenciesReflector` in the common package to change its signature and return a different interface. This change was made to support both constructor parameters and properties. The motivation behind this change is to address a bug in the reflector where returning a Map does not allow dependencies to appear more than once. Closes: #67 Please note that this is a breaking change. BREAKING CHANGE: The `reflectDependencies` method of `DependenciesReflector` now returns a different interface to accommodate the support for both constructor parameters and properties.
…ndencies Replace the data structure that stores the class dependencies after reflection. Closes: #67
c5347f3 to
aed892b
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #68 +/- ##
==========================================
- Coverage 88.61% 88.42% -0.19%
==========================================
Files 9 9
Lines 123 121 -2
Branches 13 13
==========================================
- Hits 109 107 -2
Misses 11 11
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
In this pull request, significant changes have been made to the
DependenciesReflectorinterface in the@automock/commonpackage. The reflector has been updated to utilize tuples instead of the previous Map implementation for reflecting dependencies. This modification is crucial as it allows the reflector to effectively handle the injection of the same token or class multiple times, which was not feasible with the previous Map-based approach.To ensure consistency and compatibility, corresponding changes have been made in the
@automock/coreand@automock/adapters.nestjspackages. These adjustments ensure that both packages now support the tuple-based type instead of relying on the previous Map-based implementation.Closes #67