How can I debug my application which throw this error:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxList
I ran into the same problem when testing React components using mocha and enzyme.
I was able to solve my problem by explicitly unmounting components after I had finished testing them.
The issue was that I was mounting components multiple times in my tests, which were then adding more listeners, until the number of listeners got to 11, and I got a warning.
I changed my test code by adding the rendered.unmount() line. This fixed the problem for me.
describe(' ', () => {
it('renders', function () {
const rendered = mount( );
assert.ok(rendered.find('path'));
rendered.unmount();
});
}