cypress-axe
cypress-axe copied to clipboard
How to disable standard output when using custom logging
I'm using the violationCallback parameter of cy.checkA11y() to implement custom logging. Like this:
cy.checkA11y(undefined, undefined, showViolations);
const showViolations = (violations: Result[]) => {
violations.forEach((violation: Result) => {
const { nodes, helpUrl, help, impact } = violation;
const nodesList = nodes.map((node: NodeResult) => node.target).join(', ');
const name = `${impact || ''} a11y error`;
const message = `[${help}](${helpUrl}) affecting the following node(s): [${nodesList}]. Check the console for additional error details.`;
Cypress.log({
name,
message,
consoleProps: () => violation,
$el: Cypress.$(nodesList),
});
});
};
When I do this, I see my custom logs followed by the standard output. Eg:

I don't want to see the standard output if I have custom logging in place. How can I accomplish this?