ng-mocks
ng-mocks copied to clipboard
Potential memory leak?
Discussed in https://github.com/help-me-mom/ng-mocks/discussions/5435
Originally posted by maxs-rose April 12, 2023 After running ~2K tests the JS heap reaches 1GB of memory usage and no longer goes down.
There appears to be a lot of detached dom nodes handing around that seem to be related to ngMocksUniverse
Most of the test are setup similarly to the following:
describe("some component", () => {
ngMocks.faster();
const someServiceMock = MockService(SomeService);
beforeAll(() => {
return MockBuilder(SomeComponent).mock(SomeService, someServiceMock);
);
it("should do something", () => {
const component = MockRender(SomeComponent).point.componentInstance;
component.foo();
expect(someServiceMock.serviceMethod).toHaveBeenCalled();
});
/* some more it blocks */
);
We have tried removing ngMocks.faster
but that doesn't seem to have any affect.
Is this behavior due to how we are using NgMocks?