+Nest also allows you to define a mock factory to apply to all of your missing dependencies. This is useful for cases where you have a large number of dependencies in a class and mocking all of them will take a long time and a lot of setup. To make use of this feature, the `createTestingModule()` will need to be chained up with the `useMocker()` method, passing a factory for your dependency mocks. This factory can take in an optional token, which is an instance token, any token which is valid for a Nest provider, and returns a mock implementation. Otherwise, a general mock factory, like `createMock` from [`@golevelup/ts-jest`](https://github.com/golevelup/https://github.com/golevelup/nestjs/tree/master/packages/testing) can be passed directly.
0 commit comments