Skip to content

Instantly share code, notes, and snippets.

View svkrclg's full-sized avatar
🏠
Working from home

Sk svkrclg

🏠
Working from home
View GitHub Profile
@svkrclg
svkrclg / custom_binary_test.js
Created September 29, 2020 14:19
Run specific chrome binary
const fs = require('fs');
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
(async () => {
const chrome = await chromeLauncher.launch({chromePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}); //Specify chrome binary path to run lighthouse.
const options = {logLevel: 'info', output: 'html', onlyCategories: ['performance'], port: chrome.port};
const runnerResult = await lighthouse('https://example.com', options);
// `.report` is the HTML report as a string
@svkrclg
svkrclg / unthrottle_run_time.js
Created September 29, 2020 13:42
Lighthouse Unthrottle run
/*Need to change fetch different value from url array manually.
Because performance degrades with continous run.
*/
const fs = require('fs');
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
const url = ["https://www.amazon.in/", "https://twitter.com/", "https://www.snapdeal.com/", "https://abc.com/", "https://www.ticket.at/de/home" ];
(async () => {
element = url[1]
const chrome = await chromeLauncher.launch();
@svkrclg
svkrclg / throttle_run_time.js
Last active September 29, 2020 13:41
Lighthouse Throttle run
/*Need to change fetch different value from url array manually.
Because performance degrades with continous run.
*/
//Tested for regular 3G
const fs = require('fs');
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
const url = ["https://www.amazon.in/", "https://twitter.com/", "https://www.snapdeal.com/", "https://abc.com/", "https://www.ticket.at/de/home" ];
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75;
@svkrclg
svkrclg / throttle_effect_on_score.js
Last active September 29, 2020 14:22
Lighthouse score for different network throttling
const fs = require('fs');
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
(async () => {
const chrome = await chromeLauncher.launch();
const options = {logLevel: 'info', output: 'json', onlyCategories: ['performance'], port: chrome.port};
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75;
const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR = 0.9;
const mobileRegular3g = {