How to use the lighthouse/chrome-launcher.launch function in lighthouse

To help you get started, we’ve selected a few lighthouse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ebidel / lighthouse-hue / src / runner.js View on Github external
launchChrome(headless = this.flags.headless) {
    Log.log('Lighthouse runner:', 'Launching Chrome');

    const opts = {
      chromeFlags: [
        '--window-position=40,100',
        '--window-size=412,732', // Nexus 5x
        headless ? '--headless' : ''
      ]
    };
    if (this.flags.chromePath) {
      opts.chromePath = this.flags.chromePath;
    }

    return chromeLauncher.launch(opts);
  }
github gwuhaolin / chrome-render / lib / util.js View on Github external
async function launchChrome(port) {
  return await launch({
    port: port,
    chromeFlags: [
      '--headless',
      '--disable-gpu',
      '--disable-extensions',
      '--disable-speech-api',
      '--disable-signin-scoped-device-id',
      '--disable-component-extensions-with-background-pages',
    ]
  });
}
github voorhoede / lighthouse-security / index.js View on Github external
function run(url, flags = {}) {
  const config = flags.security
    ? pageSecurityConfig
    : Object.assign({extends: 'lighthouse:default'}, pageSecurityConfig);

  return chromeLauncher.launch().then(chrome => {
    const resultsPromise = lighthouse(url, Object.assign(flags, {port: chrome.port}), config);
    resultsPromise.then(() => chrome.kill());
    return resultsPromise;
  });
}