fochlac / cypress-devserver-esbuild

minimal esbuild dev server for usage with cypress component tests
MIT License
2 stars 1 forks source link

Reloading or refreshing the webpage of the component under test causes a memory leak #2

Open GrayedFox opened 2 months ago

GrayedFox commented 2 months ago

Can be reproduced simply by adding a click event to a button that refreshes the current page or simply by using cy.reload() from inside a component test.

Screenshot 2024-07-02 at 15 57 13

Something maybe worth noting is that a refresh isn't a rebuild - or at least - should probably not be treated as such.

Will do some more digging to try and find a fix/more insightful info and update this issue when I can ⚡

fochlac commented 2 months ago

Hmm, rebuilds are triggered by two elements: either esbuild detects a filesystem change or the cypress event that implies the tests have changed. https://github.com/fochlac/cypress-ct-custom-devserver/blob/main/src/index.ts#L94 You could try disabling either of them. In general the logging for rebuilds is not great though, I have the feeling it fires too much. Reloading is working for us in our company, but we have some memory issues as well. I assumed it's caused by tests mounting the whole application, but if you can find something that would be great.

fochlac commented 2 months ago

I also found I had some unmerged changes on the 1.2 release branch that checks if a rebuild is truly required for the cypress-tests-changed-event. I'll release a 1.4.0 with that fix so you can test and check if that helps :) https://github.com/fochlac/cypress-devserver-esbuild/compare/ee1869e66be5652a2ec8711a2112792832244f72...c4c00b25f0c48140c749c92f04999e49b6106659