Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: How to run memlab on a test suite. #22

Open
SimonGodefroid opened this issue Sep 15, 2022 · 3 comments
Open

Discussion: How to run memlab on a test suite. #22

SimonGodefroid opened this issue Sep 15, 2022 · 3 comments

Comments

@SimonGodefroid
Copy link

It's all in the title, we are running tests with Testing Library + MSW on Jest and with some legacy jest mocks. The pipeline looks a bit flaky on the CI and we'd like to rule out memory leaks by running memlab on the existing test suite as opposed to creating a scenario and re-write all the test base.

Is there any chance to achieve this with the current implementation? The get started doc seemed that you need to boot up the app and run scenario to find leaks by headlessly browsing the app as opposed to running existing tests.

@JacksonGL
Copy link
Member

@SimonGodefroid Can you share an example of what your current test looks like, does your test create its own Puppeteer page object and interact with it?

@SimonGodefroid
Copy link
Author

Hey @JacksonGL so I don't have an example to share unfortunately because our company's code is closed source but essentially we run tests with Jest + React Testing Library. I guess my question is outside of the current working principles of Memlab essentially I'm asking whether there'll be a way to for instance:

$ memlab "yarn test" 

Where yarn test is your test script command e.g. react-scripts test and then Memlab would be able to track down leaks by relying on the test suite rendering the app as opposed to going through Puppeteer.

Essentially finding a memory leak on a repo would be something that you run against an existing test base (if possible) as opposed to having to setup a new tool. Then it might not be doable. I kinda thought Memlab would do what --detectOpenHandles does but super charged and without having to setup anything new.

@JacksonGL
Copy link
Member

JacksonGL commented Sep 17, 2022

@SimonGodefroid --detectOpenHandles in Jest was using async_hooks from node.js. E2E test framework like puppeteer doesn't seem to provide a callback to instrument navigation in SPA (let me know if there is one). Navigation and interaction in SPA is often application specific, MemLab doesn't know when and how to take heap snapshots without the puppeteer page object. Curious to hear if there is any ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants