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
I am using Nestjs and have implemented a logging service that acts as a wrapper for a winston logger instance with a console transport. I am running a set of jest tests inband with caching disabled. Each test creates an instance of the logging service. When each test completes the nestjs test module is closed, which in turn triggers a dispose hook on my logging service. In the dispose hook I am calling the close method on the encapsulated winston logger.
When running the series of jest tests I receive a warning concerning memory leaks....
(node:2812) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added.
Use emitter.setMaxListeners() to increase limit
In my service I am creating and disposing of the logger as follows:
I have a large spec file, and I followed the solution as stated here. However, the issue seems to persist with Jest. When I split the test file into 3 smaller files there is no longer a memory leak. Any idea what could be going on here?
Please tell us about your environment:
winston
version?_3.2.1winston@2
winston@3
node -v
outputs:_v10.6.0What is the problem?
I am using Nestjs and have implemented a logging service that acts as a wrapper for a winston logger instance with a console transport. I am running a set of jest tests inband with caching disabled. Each test creates an instance of the logging service. When each test completes the nestjs test module is closed, which in turn triggers a dispose hook on my logging service. In the dispose hook I am calling the close method on the encapsulated winston logger.
When running the series of jest tests I receive a warning concerning memory leaks....
In my service I am creating and disposing of the logger as follows:
What do you expect to happen instead?
No warning messages about memory leaks to appear after calling close on the winston logger instance.
Other information
The beforeEach and afterEach jest test hooks are included in the listing below:
The text was updated successfully, but these errors were encountered: