Log a warning on missing dependencies when using `unitRef.get(<Dep>)`
omermorad opened this issue · 0 comments
omermorad commented
Issue: Warn and Log Missing Dependencies when using unitRef.get(<Dep>)
Description:
Currently, in Automock, when using unitRef.get(<Dep>)
to retrieve a dependency from the unit reference, if the dependency is missing, it silently returns undefined
. This behavior can sometimes lead to confusion and make debugging more challenging.
To improve the developer experience and provide better feedback, we propose adding functionality to log a warning message to the console when a dependency is missing. This warning will alert developers that a required dependency is not properly configured or provided.
Implementation Plan:
- Identify the code path where
unitRef.get(<Dep>)
is called to retrieve a dependency. - Check if the requested dependency is available in the unit reference.
- If the dependency is missing, log a warning message to the console with a descriptive error indicating the missing dependency.
- Include information on how to properly configure or provide the missing dependency.
- Ensure that the warning message is informative and helpful for developers.
- Test the new functionality with different scenarios, including cases where dependencies are intentionally missing.
- Update the documentation to reflect the new behavior and provide guidelines for handling missing dependencies.