You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I would like to be able to trigger the OnModuleDestroy function for test modules created in my tests. However, this is not possible, the only method exposed is the init() function, which successfully recursively triggers the OnModuleInit function.
There should be a module.close() function similar to the module.init() function, which then recursively triggers the OnModuleDestroy function for the module and all of its providers.
afterEach(async()=>{awaitmodule.destroy();});
I noticed that a similar function already exists in nest-application.ts. It should work like that.
What is the motivation / use case for changing the behavior?
I use the OnModuleInit and OnModuleDestroy to configure certain modules. I would like to be able to clean up a module after testing, as currently some tests stay stuck after completion. This is because the destroy hook isn't being called.
The text was updated successfully, but these errors were encountered:
I'm submitting a...
Current behavior
I would like to be able to trigger the
OnModuleDestroy
function fortest modules
created in my tests. However, this is not possible, the only method exposed is the init() function, which successfully recursively triggers theOnModuleInit
function.Expected behavior
There should be a
module.close()
function similar to themodule.init()
function, which then recursively triggers theOnModuleDestroy
function for themodule
and all of itsproviders
.I noticed that a similar function already exists in nest-application.ts. It should work like that.
What is the motivation / use case for changing the behavior?
I use the
OnModuleInit
andOnModuleDestroy
to configure certain modules. I would like to be able to clean up a module after testing, as currently some tests stay stuck after completion. This is because the destroy hook isn't being called.The text was updated successfully, but these errors were encountered: