如何在Lighthouse programmaticaly中禁用限制?

时间:2018-04-18 12:29:58

标签: node.js lighthouse

根据问题标题,如何在NodeJS中以编程方式使用Lighthouse时禁用任何限制?

2 个答案:

答案 0 :(得分:1)

这应该有帮助:(在灯塔2.9.4上测试)

 lhr = await lighthouse(url, {
  port: (new URL(browser.wsEndpoint())).port,
  output: 'json',
  logLevel: 'info',

  disableDeviceEmulation: true, 
  disableCpuThrottling: true, 
  disableNetworkThrottling: true

});

答案 1 :(得分:1)

对于v3,它不是像这样工作的,而是如此处所述

https://developers.google.com/web/tools/lighthouse/v3/migration

例如喜欢:

let opts = {
    ...
    throttlingMethod: 'provided',
    throttling: {   
        throughputKbps: 8000,
        downloadThroughputKbps: 8000,
        uploadThroughputKbps: 2000
    }
};