nest: TestingModuleBuilder is missing overrideModule
Feature Request
Is your feature request related to a problem? Please describe.
I want to use mock modules to override functionalities of the module instead of overriding internals of the module again and again.
Describe the solution you’d like
A overrideModule method similar to overrideProvider would solve the issue, example:
Test.createTestingModule({
...
})
.overrideModule(LoggerModule)
.useClass(LoggerTestingModule)
.compile();
What is the motivation / use case for changing the behavior?
For the cases of e2e / integration testing in a project with many encapsulated libraries / modules it would be very helpful to be able to override entire modules instead of overriding internals of the modules every time the module is part of a testing module.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 31
- Comments: 16 (4 by maintainers)
Do we have any updates on the PR? https://github.com/nestjs/nest/pull/8777
I could really use this feature! 😃
I will build a solution if i can find some time
I had a similar issue with a
DynamicModule. I got a suggestion on how to tackle it in https://github.com/nestjs/nest/issues/11967. It might help with your use-case.Thanks @leonardovillela! Let’s track this here https://github.com/nestjs/nest/pull/8777
Hi everyone, good evening. I took some time last week to add this functionality on
testing-module.builder.tsAPI.Maintainers(cc: @kamilmysliwiec) when you have time please, take a look at this PR.
See
withModulemethod inTestModuleBuilderfrom @jbiskur/nestjs-test-utilities