{"id":13583694,"url":"https://github.com/femtopixel/google-lighthouse-puppeteer","last_synced_at":"2025-04-10T01:42:30.424Z","repository":{"id":33782203,"uuid":"161945738","full_name":"femtopixel/google-lighthouse-puppeteer","owner":"femtopixel","description":" Google Lighthouse + Puppeteer / NPM Package","archived":false,"fork":false,"pushed_at":"2024-05-02T15:50:33.000Z","size":473,"stargazers_count":50,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T03:23:47.092Z","etag":null,"topics":["automation","chrome","google-lighthouse","google-puppeteer","lighthouse","lighthouse-puppeteer","nodejs","npm","npm-module","npm-package","performance","performance-analysis","performance-metrics","performance-testing","performance-visualization","puppeteer"],"latest_commit_sha":null,"homepage":"https://brands.jaymoulin.me/femtopixel/google-lighthouse-puppeteer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/femtopixel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"jaymoulin","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.me/jaymoulin","https://www.buymeacoffee.com/jaymoulin","https://www.tipeeestream.com/cursedware/donation","https://streamlabs.com/cursedware/tip"]}},"created_at":"2018-12-15T21:36:49.000Z","updated_at":"2024-11-30T05:20:35.000Z","dependencies_parsed_at":"2024-11-06T00:32:01.102Z","dependency_job_id":"e97243d6-ea19-4cce-9052-a26576219c04","html_url":"https://github.com/femtopixel/google-lighthouse-puppeteer","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.1717171717171717,"last_synced_commit":"38dabe61325fd9a51ad05865812d2b6f0d307bf3"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/femtopixel%2Fgoogle-lighthouse-puppeteer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/femtopixel%2Fgoogle-lighthouse-puppeteer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/femtopixel%2Fgoogle-lighthouse-puppeteer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/femtopixel%2Fgoogle-lighthouse-puppeteer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/femtopixel","download_url":"https://codeload.github.com/femtopixel/google-lighthouse-puppeteer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247556196,"owners_count":20957920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","chrome","google-lighthouse","google-puppeteer","lighthouse","lighthouse-puppeteer","nodejs","npm","npm-module","npm-package","performance","performance-analysis","performance-metrics","performance-testing","performance-visualization","puppeteer"],"created_at":"2024-08-01T15:03:42.288Z","updated_at":"2025-04-06T21:32:45.020Z","avatar_url":"https://github.com/femtopixel.png","language":"JavaScript","funding_links":["https://ko-fi.com/jaymoulin","https://www.paypal.me/jaymoulin","https://www.buymeacoffee.com/jaymoulin","https://www.tipeeestream.com/cursedware/donation","https://streamlabs.com/cursedware/tip","https://www.ko-fi.com/jaymoulin"],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e As-of 2021, this product does not have a free support team anymore. If you want this product to be maintained, please support my work.\n \n\u003e [!NOTE]\n\u003e (This product is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many  desirable features yet to be added.)\n \n![logo](logo.png)\n\nLighthouse Puppeteer - NPM Package\n==================================\n\n[![latest release](https://img.shields.io/github/release/femtopixel/google-lighthouse-puppeteer.svg \"latest release\")](http://github.com/femtopixel/google-lighthouse-puppeteer/releases)\n[![NPM release](https://img.shields.io/npm/v/google-lighthouse-puppeteer.svg \"NPM release\")](https://www.npmjs.com/package/google-lighthouse-puppeteer)\n[![PayPal donation](https://github.com/jaymoulin/jaymoulin.github.io/raw/master/ppl.png \"PayPal donation\")](https://www.paypal.me/jaymoulin)\n[![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png \"Buy me a coffee\")](https://www.buymeacoffee.com/jaymoulin)\n[![Buy me a coffee](https://ko-fi.com/img/githubbutton_sm.svg \"Buy me a coffee\")](https://www.ko-fi.com/jaymoulin)\n\n* [Google Chrome Headless](https://developers.google.com/web/updates/2017/04/headless-chrome) is the Google Chrome browser that can be started without graphical interface to accomplish several tasks (PDF printing, performance, automation...)\n* [Google Lighthouse](https://developers.google.com/web/tools/lighthouse/) analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.\n* [Google Puppeteer](https://github.com/GoogleChrome/puppeteer) is a tool to automate tasks on a Chrome (headless) browser.\n\nDescription\n-----------\n\nThe purpose of this package image is to produce performance report for several pages in connected mode and in an automated (programmated) way.\n\nIt uses [lighthouse-batch](https://github.com/mikestead/lighthouse-batch) to be able to automate export of multiple\n\n### Installation\n\n```\nnpm install -g google-lighthouse-puppeteer --unsafe-perm=true\n```\n\n### CLI Usage\n\n```\n$\u003e lighthouse-puppeteer -h\n\nOptions\n\n  -f, --file FILE         Path to your testcase REQUIRED (default option)\n                          (example: /home/chrome/testcases/mytestcase.js)\n  -p, --port PORT         Chrome headless debug port (default: 9222)\n  -c, --chromium_params   Optional parameters to pass to chrome/chromium browser\n                            (https://peter.sh/experiments/chromium-command-line-switches/)\n                            (example: \"- --no-sandbox --disable-setuid-sandbox --ssl-version-max=tls1.1\")\n  -v, --verbose           Providing this option once will show more info from Lighthouse.\n                            Providing it twice will additionally provide info from `lighthouse-batch`.\n  -h, --help              Print this usage guide.\n\nLighthouse\n\n  -d, --output_directory FOLDER   Path to output reports\n                                  (default: /home/chrome/reports)\n  -w, --html                      Renders HTML reports alongside JSON reports\n  -l, --lighthouse_params         Optional parameters to pass to lighthouse\n                                  (https://github.com/GoogleChrome/lighthouse/#cli-options)\n                                  (example: \"- --quiet --perf\")\n\nPuppeteer\n\n  You can add your options for puppeteer by prefixing them with --puppeteer-\n  (https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)\n\n  example: \"--puppeteer-ignoreHTTPSErrors --puppeteer-slowMo 20\"\n```\n\n### Docker\n\nYou can see https://github.com/femtopixel/docker-google-lighthouse-puppeteer or https://hub.docker.com/r/femtopixel/google-lighthouse-puppeteer for more informations.\n\n### Environment\n\nIf you want to use your own Chrome/Chromium instead of the provided by Puppeteer, you can add the following two environment variables:\n\n```bash\n# This environment is used by puppeteer to know where your chrome browser installed in located\nCHROME_PATH=/usr/bin/chromium-browser\n# This environment tells puppeteer and npm to not install the browser in node_modules\nPUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true\n```\n\n### Package Usage\n\n```javascript\nconst lp = require('google-lighthouse-puppeteer');\nconst options = {};\nlp.exec('/path/to/my/test.js', options)\n    .then(() =\u003e console.log('everything ok'))\n    .catch((err) =\u003e console.error(err));\n```\n### Options\n\nYou can change some options like in CLI :\n\n```json\n{\n    \"main\": {\n      \"port\":9222,\n      \"verbose\":[true, true]\n    },\n    \"lighthouse\": {\n        \"params\":\"\",\n        \"output_directory\":\"/home/chrome/reports\",\n        \"lighthouse_params\":\"\"\n    },\n    \"chromium\": \"--no-sandbox --disable-setuid-sandbox --ssl-version-max=tls1.1\",\n    \"_unknown\": [\n        \"--puppeteer-ignoreHTTPSErrors\",\n        \"--puppeteer-slowMo\",\n        \"20\"\n    ]\n}\n```\n\nFor puppeteer, all params must be added in the `_unknown` entry and are prefixed with `--puppeteer-`. Each value must be in separated entry.\n\n`verbose` is an array of true, the more `true` the more talkative the application.\n\nLighthouse params can be added respecting [their documentation](https://github.com/GoogleChrome/lighthouse/#cli-options)\n\n### API\n\nYou should create a testcase file named `whateverYouWant.js`.\n\nThis file must `module.exports` an object which must contain two methods : `connect` and `getUrls`.\n\n#### connect\n\nThis method must return a `Promise` which resolves the browser (first argument received of the method connect).\n\nThe purpose of this method is to connect the user to the browser.\n\n#### getUrls\n\nThis method must return an array of string for the url to be tested. You can put url restricted by connection since the `connect` method will grant you access.\n\n#### Implementation\n\n```js\nclass whateverYouWant\n{\n    getUrls() {\n        return [\n           \"https://myawsome.site/admin/heavypage\",\n           \"https://myawsome.site/admin/lightpage\",\n       ];\n    }\n\n    connect(browser) {\n        return new Promise(async (resolve, reject) =\u003e {\n            const page = await browser.newPage();\n            await page.goto('https://myawesome.site/admin/authentication', {waitUntil: 'load'});\n            await page.type('#login', 'admin');\n            await page.type('#password', 'admin');\n            await page.$eval('#form input[type=submit]', x =\u003e x.click());\n            await page.waitForNavigation({waitUntil: 'networkidle2'});\n            resolve(browser);\n        });\n    }\n}\n\nmodule.exports = new whateverYouWant();\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemtopixel%2Fgoogle-lighthouse-puppeteer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffemtopixel%2Fgoogle-lighthouse-puppeteer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemtopixel%2Fgoogle-lighthouse-puppeteer/lists"}