Skip to content

v1.4.0

Compare
Choose a tag to compare
@omermorad omermorad released this 06 Aug 04:55
· 151 commits to master since this release
61822a1

🚀 Features

  • common: add symbol and type for undefined dependency (681f670)

  • adapters.nestjs: support undefined dependency reflection (a9ccaa6)

  • core: support undefined dependency from adapter (b85132d)

Closes #84

🗒️ Release Notes

The improvements in version v1.4.0 of Automock are twofold, applying changes both in the core library (@automock/core) and the NestJS adapter (@automock/adapters.nestjs) to enhance the class reflection process and better handle scenarios where dependencies are detected as "undefined."

Enhancements in @automock/core

In @automock/core, we have focused on strengthening the class reflection logic to handle undefined values encountered during dependency detection. Previously, when the reflector encountered cases where the type of a dependency could not be determined or was reflected as undefined, it posed challenges in the unit testing process, potentially leading to runtime errors or unexpected behavior.

To address this, the core library now accommodates undefined values during class reflection, ensuring a more robust and flexible reflection process. The introduction of Symbol as a placeholder for undefined dependencies allows Automock to proceed with class mocking and unit testing without interruption, even in the presence of circular dependencies or circular file imports.

Enhancements in @automock/adapters.nestjs

The NestJS adapter, @automock/adapters.nestjs, plays a critical role in reflecting class dependencies for NestJS applications. To align with the improvements in the core library, we have also made updates to the NestJS adapter to properly handle undefined values during class reflection.

When @automock/core triggers the class reflection process using the NestJS adapter, it now correctly identifies undefined values for dependencies and replaces them with the Symbol placeholder. This ensures seamless integration with the NestJS framework and eliminates potential issues arising from unresolved dependencies.