Giter Site home page Giter Site logo

Support for cypress about memlab HOT 4 OPEN

facebook avatar facebook commented on May 9, 2024
Support for cypress

from memlab.

Comments (4)

JacksonGL avatar JacksonGL commented on May 9, 2024 4

MemLab can analyze heap snapshots taken from V8. In your case, write scripts to take heap snapshots from Cypress (if Cypress supports taking heap snapshots from browser) and put them into disk in the format that can be processed by MemLab.

Here is what the MemLab output files look like (only run-meta.json, snap-seq.json and all .heapsnapshot files are necessary):
https://facebook.github.io/memlab/docs/guides/integration-and-file-structure/#collect-results

To get examples of those meta files, run a random MemLab test scenario and view those files under this directory: $(memlab get-default-work-dir)/data/cur.

When the files are ready, create a result reader:

const reader = BrowserInteractionResultReader.from(directory);

Then find memory leaks with the reader and this MemLab API:
https://facebook.github.io/memlab/docs/api/modules/api_src#findleaksrunresult

from memlab.

Levix avatar Levix commented on May 9, 2024 1

Can't find a way for cypress to take heap snapshots, embarrassing.

from memlab.

JacksonGL avatar JacksonGL commented on May 9, 2024 1

@Levix I've never used Cypress before, but it seems Cypress supports Chrome DevTools Protocol, which could be used to get JS heap snapshots from Chromium.

Here is the code pointer of how memlab uses puppeteer to collect the heap snapshots from Chromium.

from memlab.

Levix avatar Levix commented on May 9, 2024 1

@Levix I've never used Cypress before, but it seems Cypress supports Chrome DevTools Protocol, which could be used to get JS heap snapshots from Chromium.

Here is the code pointer of how memlab uses puppeteer to collect the heap snapshots from Chromium.

Here is an article written in Chinese on how to take heap snapshots.
https://github.com/Levix/weekly/blob/feat-docs-cypress-heap/article/2022/%E4%BD%BF%E7%94%A8%20Cypress%20%E6%8B%8D%E6%91%84%E5%A0%86%E5%BF%AB%E7%85%A7%EF%BC%88Take%20snapshot%EF%BC%89/%E4%BD%BF%E7%94%A8%20Cypress%20%E6%8B%8D%E6%91%84%E5%A0%86%E5%BF%AB%E7%85%A7%EF%BC%88Take%20snapshot%EF%BC%89.md

from memlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.