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

Possibility to analyze memory leaks/usage in Jest #14

Open
tmkasun opened this issue Sep 13, 2022 · 3 comments
Open

Possibility to analyze memory leaks/usage in Jest #14

tmkasun opened this issue Sep 13, 2022 · 3 comments

Comments

@tmkasun
Copy link

tmkasun commented Sep 13, 2022

Hi Team,

First of all, Thank you very much for making this project open source, AFAIK there are very few opensource tools like memlab to analyze memory leaks in SPA apps, Hope this will be an excellent help for frontend developers to identify memory leaks in the Single Page Apps.

My question is, Is it possible to analyze the memory usage or leaks in tests written using the Jest framework?

@JacksonGL
Copy link
Member

JacksonGL commented Sep 13, 2022

MemLab tests its APIs with Jest. Please check out the src/__test__ folder of each memlab packages for more examples.

To find memory leaks in SPA using Jest, here is one example:
https://github.com/facebookincubator/memlab/blob/main/packages/api/src/__tests__/API/E2EFindMemoryLeaks.test.ts
(more examples under the packages/api/src/__tests__ folder)

If you would like to analyze memory in node.js, MemLab provides the following APIs:

Here is an example of using MemLab with Jest:
https://facebookincubator.github.io/memlab/docs/api/interfaces/core_src.IHeapSnapshot/#hasobjectwithtagtag

@tmkasun
Copy link
Author

tmkasun commented Sep 13, 2022

Thank you very much @JacksonGL for the quick response, I will have a look at the MemLab tests and other materials.

@derN3rd
Copy link

derN3rd commented Sep 13, 2022

I think the question was more like "Is there any way/functionality already that allows us to throw this tool onto our jest tests to find memory leaks in it".

At least thats my question, but after reading through the code, docs and examples I couldn't find anything.

facebook-github-bot pushed a commit that referenced this issue Jul 6, 2023
…ing frameworks

Summary:
This diff adds a new documentation page for how to integrate E2E testing framework with MemLab. In case anyone wants to detect memory leaks by running tests in other E2E testing frameworks such as Playwright or Cypress etc.

Related to #35, #15, #14

Reviewed By: tulga1970

Differential Revision: D47247084

fbshipit-source-id: 0620defa7114bf77e3248472b424541f8cec481b
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

3 participants