v2.0.0
Automock 2.0.0 🎊
This release introduces significant changes to the Automock library, aiming to enhance its adaptability, maintainability, and developer experience. The changes are a culmination of feedback, the need to support a broader spectrum of use-cases, and support variety of DI adapters.
🚀 Features
- jest: replace
jest-mock-extended
with native mocking functionality (6148f14) - sinon: replace
@golevelup/ts-sinon
with native mocking functionality (080117b) - types: simplify deep partial and stubbed instance types (8831892)
- adapters.nestjs: transition from dependencies map to container (9192234)
🔁 Code Refactoring
- jest: drop support for jest v25.x (18e1677)
- jest: drop support for native nestjs adapter (85432d0)
- jest: drop support for node v14 and v12 (ef2b729)
- jest: improve interfaces and remove types (4bc96e2)
- sinon: drop support for native nestjs adapter (0925ea2)
- sinon: drop support for node v14 and v12 (7d81ff2)
- sinon: improve interfaces and remove types (0292fed)
- sinon: update sinon and sinon types peer dependencies (5fa1ccf)
- common: drop support for node v14 and v12 (08f0678)
- common: overhaul interfaces and introduce new adapters mechanism (32ab0ab)
- core: drop support for node v14 and v12 (827ff5c)
- core: enhance dependency handling and error management (0271fe0)
⚙️ BREAKING CHANGES
jest
- Users will need to update their imports due to the relocation of
Type
andUnitTestBed
. Adjustments may be required for the newUnitReference
interface. - Remove built in support for NestJS adapter from package.json dependencies
- Drop support for jest v25.x, update package.json peer dependencies to new jest version range
- Setup engines for node to be v16 to v20, drop support for v12 and v14
- Remove export of
MockFunction
sinon
- Users will need to update their imports due to the relocation of
Type
,UnitTestBed
andMockFunction
. - Adjustments may be required for the new
UnitReference
interface. - The peer dependency for
sinon
has been narrowed from any version (*) to a specific range (10 - 16). Additionally, a new peer dependency for@types/sinon
with a version range of 9 - 10 has been introduced. Users should ensure they have the correct versions of sinon and@types/sinon
installed to avoid compatibility issues. - Remove built in support for NestJS adapter from package.json dependencies
- Setup engines for node to be v16 to v20, drop support for v12 and v14
types
- Removed array handling in
DeepPartial
and changed structure ofStubbedInstance
. This change narrows the type to only include stubbed members, removing the intersection with the original class type.
common
- Eliminate multiple interfaces and types:
ClassDependencies
,ClassCtorInjectables
,ClassInjectableProperty
,ClassPropsInjectables
,ClassDependenciesMap
,DependenciesReflector
- Transition from
PrimitiveValue
to the more descriptiveConstantValue
. - Setup engines for node to be v16 to v20, drop support for v12 and v14
core
- Transition from native
Error
to custom Automock errors - Update
UnitReference.get()
to return bothConstantValue
andStubbedInstance
. - Setup engines for node to be v16 to v20, drop support for v12 and v14
adapters.nestjs
- Modify export strategy: Shift from native literal export to default module export