Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run Lighthouse from Cypress, install the cypress-lighthouse-plugin, prepare Chrome when Cypress launches, register the plugin’s Node task, import its commands, and call cy.lighthouse() after visiting the page. You can save the resulting report and configure thresholds. For a dedicated URL-based performance collection and report history, run Lighthouse CI as a separate job instead. The integration below is documented by a community plugin, so verify its current compatibility with your Cypress, Lighthouse, Node, and Chrome versions before adopting it.

What you need before adding Lighthouse to Cypress

  • A Cypress project with its application available to test.
  • Chrome or Chromium: the plugin’s documented setup prepares Chrome for Lighthouse audits.
  • The cypress-lighthouse-plugin package and its Lighthouse peer dependency. Check the package metadata and release history for versions compatible with your project; the documentation does not establish a current compatibility matrix.
  • A Node version supported by the specific Lighthouse package you install. The current GoogleChrome Lighthouse README says the Node CLI requires Node 22 LTS or later; verify the requirement for your installed integration and Lighthouse versions.

The Cypress plugin catalog describes listed plugins as community-owned rather than reviewed by Cypress. Treat this integration as a third-party dependency and evaluate its maintenance and compatibility before relying on it in a blocking CI gate.

Install the Cypress Lighthouse integration

From the project root, install the package using the command documented in the plugin README:

npm install cypress-lighthouse-plugin

The README states that Lighthouse is installed as a peer dependency. Confirm the actual installed package versions and peer dependency requirements in your project, especially if you use a newer Cypress or Lighthouse release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Configure Cypress to prepare Chrome and register the task

In your Cypress configuration file, prepare the browser during launch and register the plugin’s Lighthouse task inside setupNodeEvents. The following follows the plugin’s documented CommonJS-style setup; adapt the imports and configuration export to your project’s module format.

const lighthouse = require('lighthouse');
const { defineConfig } = require('cypress');
const { prepareAudit } = require('cypress-lighthouse-plugin');

module.exports = defineConfig({
  defaultBrowser: 'chrome',
  e2e: {
    setupNodeEvents(on, config) {
      on('before:browser:launch', (browser = {}, launchOptions) => {
        if (browser.name === 'chrome' || browser.name === 'chromium') {
          prepareAudit(launchOptions);
        }
        return launchOptions;
      });

      on('task', {
        lighthouse: lighthouse(),
      });

      return config;
    },
  },
});

Keep the browser-launch hook: the plugin’s documented approach uses it to prepare Chrome for auditing. If your project already has a setupNodeEvents function or browser-launch handler, merge the task and preparation logic into the existing configuration rather than defining competing handlers.

Load the commands and audit a visited page

Import the plugin commands from your Cypress support file, typically cypress/support/e2e.js in projects using that layout:

import 'cypress-lighthouse-plugin/commands';

Then visit the page in a spec and run the audit. The callback in this example writes the plugin-provided JSON report to a file, as shown in the README:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
describe('page performance', () => {
  it('audits the home page', () => {
    cy.visit('http://localhost:3000');
    cy.lighthouse((lighthouseResult) => {
      cy.writeFile('lighthouse-report.json', lighthouseResult.report);
    });
  });
});

Replace the URL with the page your app serves in the test environment. Ensure that the page is fully reachable and in the intended state before the audit runs; if the journey requires navigation or interaction, perform it with Cypress before calling cy.lighthouse().

Set thresholds without making noise a CI failure

The plugin README demonstrates configurable Lighthouse thresholds, including performance and accessibility examples. Treat those values as syntax examples, not universal targets or established benchmarks. Start by capturing results repeatedly under your own CI conditions, then choose thresholds that detect meaningful regressions while allowing for measurement variability.

  • Establish a baseline for the pages and environment you intend to gate.
  • Check whether runs are repeatable before making a threshold failure block merges.
  • Use thresholds that reflect product requirements rather than copying example values from the README.
  • Roll out score gates gradually. Lighthouse CI’s guide recommends learning how the team interprets measurements before relying on them as hard blockers.

Thresholds can be useful for regression detection, but a Lighthouse score is a measurement from a particular run and environment. Avoid treating one score as a guaranteed representation of every user’s experience.

Run Cypress Lighthouse tests in CI

CI must start the app and wait until it responds before Cypress begins. Cypress documents server-readiness patterns using tools such as start-server-and-test and wait-on. A fixed sleep can waste time or still race; use a readiness check against the app URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  1. Start the application using the command appropriate to your project.
  2. Wait for the test URL to respond, using a readiness tool or your CI platform’s equivalent.
  3. Run Cypress with cypress run in the prepared browser environment.
  4. Retain the report file as a CI artifact if you need to inspect results after the job.

For example, a package script can use start-server-and-test so the test command runs only after the local server responds:

npx start-server-and-test start http://localhost:3000 cypress:run

Define the start and cypress:run scripts in package.json for your app and Cypress command. This is a pattern, not a universal command: the server command and URL must match your project. Cypress’s CI guide also documents wait-on patterns.

Choose a browser container deliberately. Cypress’s browser Docker images bundle browsers and compatible runtime components; specifying an image tag helps control which environment runs the test. The Lighthouse plugin path still requires Chrome/Chromium.

Choose between Lighthouse in Cypress and Lighthouse CI

Decision Lighthouse inside Cypress Separate Lighthouse CI job
Best suited to Auditing a point in an end-to-end flow that Cypress controls. Collecting audits for configured URLs in a dedicated performance job.
Setup Community plugin, Chrome/Chromium launch preparation, registered Cypress task, support import, and cy.lighthouse(). Lighthouse CI CLI and configuration in CI, with a chosen collection and upload setup.
Reports The plugin callback can write the report to a file. Upload targets can expose reports; a Lighthouse CI server can provide historical reports and comparisons.
Thresholds The plugin README demonstrates configurable thresholds. Lighthouse CI supports assertion presets and custom configuration.
Main caution Verify the community plugin’s compatibility and maintenance for your stack. Check example runtime and package versions; some getting-started snippets use older versions.

Lighthouse CI’s getting-started guide describes temporary public report storage that provides individual report links but not historical storage, diffs, or build failures. For history and comparisons, its documentation describes configuring a server. Use the upload approach that fits your retention and access needs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Version and measurement cautions

  • Node: GoogleChrome Lighthouse’s README currently says the Node CLI requires Node 22 LTS or later. Lighthouse CI getting-started examples include Node 16 and Lighthouse CI CLI 0.15.x; those are examples, not proof of compatibility with current Lighthouse. Verify requirements for the exact packages you install.
  • Plugin compatibility: The cited plugin documentation does not establish a tested matrix across current Cypress, Lighthouse, Chrome, and Node releases. Check package metadata and recent release history before pinning versions.
  • Machine variability: Lighthouse CI notes that larger machines produce more stable results. Keep the CI environment reasonably consistent when comparing runs.
  • Authenticated pages: Lighthouse CI configuration documents using a Puppeteer script to log in or prepare browser state before Lighthouse runs. If the primary goal is an authenticated URL collection rather than a Cypress-controlled user journey, that may be a better fit than embedding each audit in Cypress.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The audit does not run or Chrome launch fails

Confirm Cypress is launching Chrome or Chromium and that your browser-launch hook calls prepareAudit(launchOptions). Check that your installed plugin and Lighthouse versions support the Node and browser versions in the job.

cy.lighthouse() is undefined

Make sure the support file imported cypress-lighthouse-plugin/commands and that the spec is running with the Cypress configuration that loads that support file.

The test starts before the application is ready

Replace an uncoordinated background server command with a readiness check that waits for the test URL to respond. Cypress documents start-server-and-test and wait-on patterns for this purpose.

Scores or threshold failures vary from run to run

Check whether the machine and browser environment are consistent, capture a baseline across repeated runs, and avoid using thresholds tighter than the observed variation supports. Roll out a gate gradually instead of treating an example threshold as an expected score.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

The report is missing after CI completes

Verify the callback writes the report to the expected path and configure the CI job to preserve that file as an artifact. A file written during a job is not automatically retained after the job ends.

Or skip the browser setup

If you need a screenshot rather than a Lighthouse performance audit, ScreenshotNeo offers a one-request screenshot API. It does not replace Lighthouse metrics or Cypress user-flow tests. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed; its MCP server lets AI agents take screenshots. One thousand screenshots a month are free with no card, and paid plans start at $5 for 3,000.

See the ScreenshotNeo API documentation. Example cURL request:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo returns an image or PDF from a GET request; its clean-shot handling and per-response billing verdicts are useful when the task is capturing a page, not measuring performance. Sign up for 1,000 free screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sources

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.