suites-dev/suites

Log a warning on missing dependencies when using `unitRef.get(<Dep>)`

omermorad opened this issue · 0 comments

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:

  1. Identify the code path where unitRef.get(<Dep>) is called to retrieve a dependency.
  2. Check if the requested dependency is available in the unit reference.
  3. If the dependency is missing, log a warning message to the console with a descriptive error indicating the missing dependency.
  4. Include information on how to properly configure or provide the missing dependency.
  5. Ensure that the warning message is informative and helpful for developers.
  6. Test the new functionality with different scenarios, including cases where dependencies are intentionally missing.
  7. Update the documentation to reflect the new behavior and provide guidelines for handling missing dependencies.