As per <the Nest.js docs>, I wait for the Nest app...
# prisma-client
b
As per the Nest.js docs, I wait for the Nest app to close before letting Prisma terminate:
Copy code
enableShutdownHooks(app: INestApplication) {
  this.$on('beforeExit', async () => {
    await app.close();
  });
}
This code is important to us (since if Prisma terminates the process before Nest can gracefully shutdown, we end up with a whole bunch of leftover resources that need to be manually cleaned up), and as such I'm looking to write a test for it...but I'm unsure how to go about that - does anyone have any suggestions please? Previously I'd have mocked the implementation of
$on()
, but
3.9.0
made that readonly so that's not possible anymore (Jest only allows readonly properties to be mocked if they're not a function)