New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cypress-lighthouse

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-lighthouse

Lighthouse Runner for within Cypress

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by42.26%
Maintainers
1
Weekly downloads
 
Created
Source

Cypress Lighthouse Plugin

Cypress Lighthouse Plugin is a lighthouse plugin that adds the cy.lighthouse command to audit websites against the lighthouse performance metrics.

Installation

Use npm or yarn to install cypress-lighthouse

npm install cypress-lighthouse
yarn add cypress-lighthouse

Import the commands at the top of your test file.

import 'cypress-lighthouse';

API

Syntax

.lighthouse(url)

Usage

describe('Performance Metrics for https://google.com', () => {
  before(function () {
    cy.lighthouse('https://google.com').as('results')
  });
  it('Meets performance benchmarks', function () {
    // Assert that the performance metric is greater than .85
    cy.wrap(this.results.performance).should('be.gt', .85);
  })
});

Arguments

url (string)
Any valid URL.

Yields

A chaining component with the results of the lighthouse audit. Example:

{
  "performance": 0.16, 
  "accessibility": 0.72, 
  "best-practices": 0.79, 
  "seo": 0.92, 
  "pwa": 0.3
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FAQs

Package last updated on 06 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc