Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cypress-html-validate

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-html-validate

Cypress plugin for html-validate

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3K
decreased by-56.24%
Maintainers
1
Weekly downloads
 
Created
Source

Cypress HTML-Validate plugin

Validates HTML using html-validate. It automatically fetches the active source markup from the browser and validates, failing the test if any validation errors is encountered.

Usage

In cypress/plugins/index.js:

const htmlvalidate = require("cypress-html-validate/dist/plugin");

module.exports = (on) => {
  htmlvalidate.install(on);
};

In cypress/support/index.js:

import "cypress-html-validate/dist/commands";

In specs:

it("should be valid", () => {
  cy.visit("/my-page.html");
  cy.htmlvalidate();
});

Configuration

html-validate and the plugin can configured in cypress/plugins/index.js:

/* html-validate configuration */
const config = {
  rules: {
    foo: "error",
  },
};
/* plugin options */
const options = {
  exclude: [],
  include: [],
  formatter(messages) {
    console.log(messages);
  },
};
htmlvalidate.install(on, config, options);

Options

exclude: string[]

A list of selectors to ignore errors from. Any errors from the elements or any descendant will be ignored.

include: []

A list of selectors to include errors from. If this is set to non-empty array only errors from elements or any descendants will be included.

formatter

  • type: (messages: ElementMessage[]): void

Custom formatter/reporter for detected errors. Default uses console.table(..) to log to console. Set to null to disable.

Keywords

FAQs

Package last updated on 21 Feb 2021

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