facebook / memlab

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

core_1.browserInfo.setPuppeteerConfig is not a function #109

Closed DaveMBush closed 5 months ago

DaveMBush commented 5 months ago

When running this script:

import * as memlab from 'memlab';
import { scenario as demoStandard } from './demo/base-line-to-tree';

(async function () {
  // I've also tried importing run from @memlab/core and using it instead of
  // memlab.run(...)
  const { leaks, runResult } = await memlab.run({ scenario: demoStandard });
  if (leaks.length > 0) {
    console.log(
      runResult.getRunMetaInfo().browserInfo._consoleMessages.join('\n'),
    );
  } else {
    console.log('No leaks detected');
  }
  runResult.cleanup();
})();

I get output while it is running memlab.run(...) and then the error:

core_1.browserInfo.setPuppeteerConfig is not a function

image

I've run with the debugger and it never hits the if(leaks.length) line.

The error sounds like a puppeteer version mismatch but I've verified I don't have any version of puppeteer other than what memlab installs and they are all the same version.

The file I'm working in is located here if it helps track down what I'm doing wrong: https://github.com/DaveMBush/SmartNgRX/blob/dmb/add-additional-memlab-tests/286/apps/demo-memlab/src/memlab/main.ts

Finally, I'm moving from using the cli to using a node script. The cli version works which you can view by looking at the main branch. So the only new packages are the @memlab packages I had to install for the script. I've also moved to typescript instead of plain javascript so I can run the code with ts-node.

Any help at all would be greatly appreciated.

JacksonGL commented 5 months ago

@DaveMBush Looks like your @memlab/core package is outdated. In the latest version of MemLab, an internal method called setPuppeteerConfig was renamed. I would recommend removing all the @memlab/* packages in node_modules directory and reinstall memlab.

DaveMBush commented 5 months ago

Actually, it was @memlab/api. I must have grabbed that one just before the change as it is the only one that wasn't using the most recent version.

Thanks for the fast reply to a stupid question.