facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.35k stars 118 forks source link

'beforeInitialPageLoad' does not exist in type 'IScenario' #49

Closed liunnn1994 closed 1 year ago

liunnn1994 commented 1 year ago

Until the latest version (v1.1.33) beforeInitialPageLoad not working. But i saw it's already in core and docs. Did I use it incorrectly?

image

JacksonGL commented 1 year ago

@asdjgfr beforeInitialPageLoad should be available since v1.1.30. Please double check the version you are using (there is a memlab version command).

JacksonGL commented 1 year ago

@asdjgfr The type mismatch is probably because puppeteer types are not compatible across different versions. The Page type from puppeteer under your projects' node_modules/puppeteer directory is different from the Page type defined under node_modules/@memlab/core/node_modules/puppeteer directory.

One way to fix is align the puppeteer type by npm install puppeteer@<version> (version is the puppeteer version under node_modules/@memlab/core/node_modules/puppeteer).

liunnn1994 commented 1 year ago

@JacksonGL Thx, run memlab version command gets the flowing information:

memlab@1.1.33
 @memlab/heap-analysis@1.0.10
 @memlab/e2e@1.0.13
 @memlab/core@1.1.12
 @memlab/cli@1.0.15
 @memlab/api@1.0.12

@memlab/api version incorrectly. Removed node_modules and package-lock.json then reinstall dependencies fixed this issue.