Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
cypress-html-validate
Advanced tools
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.
npm install --save-dev html-validate cypress-html-validate
Make sure you install both html-validate
and the plugin cypress-html-validate
.
With NPM 7 or later it will be satisfied by the peer dependency but for a more consistent and deterministic experience it is suggested to include both as dependencies for your project.
cypress/plugins/index.js
:const htmlvalidate = require("cypress-html-validate/dist/plugin");
module.exports = (on) => {
htmlvalidate.install(on);
};
cypress/support/index.js
:import "cypress-html-validate/dist/commands";
it("should be valid", () => {
cy.visit("/my-page.html");
cy.htmlvalidate();
});
To automatically run after each test you can use afterEach
either in the spec file or in cypress/support/index.js
:
afterEach(() => {
cy.htmlvalidate();
});
html-validate
and the plugin can configured globally 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);
See html-validate documentation for full description of configuration.
If you want to override per call you can pass configuration and/or options directly to the function:
cy.htmlvalidate([config], [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
(messages: ElementMessage[]): void
Custom formatter/reporter for detected errors.
Default uses console.table(..)
to log to console.
Set to null
to disable.
FAQs
Cypress plugin for html-validate
The npm package cypress-html-validate receives a total of 2,733 weekly downloads. As such, cypress-html-validate popularity was classified as popular.
We found that cypress-html-validate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.