{"id":15433605,"url":"https://github.com/mmarkelov/jest-lighthouse","last_synced_at":"2026-04-09T08:08:01.972Z","repository":{"id":54654008,"uuid":"334492148","full_name":"mmarkelov/jest-lighthouse","owner":"mmarkelov","description":"Helper functions to simplify jest integration with lighthouse","archived":false,"fork":false,"pushed_at":"2021-02-06T12:39:19.000Z","size":164,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-04T21:17:20.046Z","etag":null,"topics":["e2e-tests","expect","jest","lighthouse","playwright","puppeteer","testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mmarkelov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-30T19:15:25.000Z","updated_at":"2021-03-31T12:08:22.000Z","dependencies_parsed_at":"2022-08-13T23:00:31.376Z","dependency_job_id":null,"html_url":"https://github.com/mmarkelov/jest-lighthouse","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mmarkelov/jest-lighthouse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmarkelov%2Fjest-lighthouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmarkelov%2Fjest-lighthouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmarkelov%2Fjest-lighthouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmarkelov%2Fjest-lighthouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmarkelov","download_url":"https://codeload.github.com/mmarkelov/jest-lighthouse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmarkelov%2Fjest-lighthouse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266765125,"owners_count":23980704,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["e2e-tests","expect","jest","lighthouse","playwright","puppeteer","testing"],"created_at":"2024-10-01T18:34:39.539Z","updated_at":"2026-04-09T08:08:01.942Z","avatar_url":"https://github.com/mmarkelov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest-lighthouse\n\n![CI](https://github.com/mmarkelov/jest-lighthouse/workflows/Node.js%20CI/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/mmarkelov/jest-lighthouse/badge.svg)](https://coveralls.io/github/mmarkelov/jest-lighthouse)\n![npm](https://img.shields.io/npm/v/jest-lighthouse)\n\nHelper functions to simplify [Jest](https://github.com/facebook/jest) integration with [Lighthouse](https://github.com/GoogleChrome/lighthouse)\n\n```bash\nnpm install -D jest-lighthouse\n```\n\n## toHaveLighthouseAudit\n\n**expect(lhr: [Report](https://github.com/GoogleChrome/lighthouse/blob/master/docs/understanding-results.md#lighthouse-result-object-lhr)).toHaveLighthouseAudit(category: string, value?: \u003cnumber | Score\u003e)**\n\nThis function check if lighthouse report pass audit\n\n## Using with [jest-playwright](https://github.com/playwright-community/jest-playwright)\n\n```js\n// jest-playwright.config.js\nmodule.exports = {\n  ...\n  launchType: 'LAUNCH',\n  launchOptions: {\n    args: ['--remote-debugging-port=9222'],\n    headless: true,\n  },\n}\n\n// test file\nconst { getLighthouseReport } = require(\"jest-lighthouse\");\n\n...\n\ndescribe('Lighthouse', () =\u003e {\n  let lhr;\n  beforeAll(async () =\u003e {\n    const port = 9222; // same port as defined in launchOptions\n    lhr = await getLighthouseReport(url, port);\n  });\n  it('passes an seo audit through Lighthouse', async () =\u003e {\n    expect(lhr).toHaveLighthouseAudit('seo', 90);\n  });\n})\n\n...\n```\n\n## Using with [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer)\n\n```js\n// test file\nconst { getLighthouseReport } = require(\"jest-lighthouse\");\n\n...\n\ndescribe('Lighthouse', () =\u003e {\n  jest.setTimeout(15000);\n  let lhr;\n  beforeAll(async () =\u003e {\n    const port = new URL(browser.wsEndpoint()).port;\n    lhr = await getLighthouseReport(url, port);\n  });\n  it('passes an accessibility audit through Lighthouse', async () =\u003e {\n    expect(lhr).toHaveLighthouseAudit('performance', 'perfect');\n  });\n})\n\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmarkelov%2Fjest-lighthouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmarkelov%2Fjest-lighthouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmarkelov%2Fjest-lighthouse/lists"}