July 2018
Intermediate to advanced
354 pages
8h 51m
English
Like Sonar (which will be covered in the next section) and the other node-based utilities, you can also use Lighthouse in your own node scripts and modules. You need to create references to both the Lighthouse and chrome-launcher modules:
const Lighthouse = require("Lighthouse"),
chromeLauncher = require('chrome-launcher');
Both the Chrome Launcher and Lighthouse modules return promises. You must create a new Chrome instance before launching Lighthouse.
Chrome Launcher resolves a reference to a Chrome instance. You need to pass the developer port number to the Lighthouse module. This is how Lighthouse communicates with Chrome to perform the tests:
function launchChromeAndRunLighthouse(url, flags, config ...
Read now
Unlock full access