component-driven / component-driven/cypress-axe

How to disable standard output when using custom logging

Open
#107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
641
Forks
90
Avg merge
6h 8m
Merged PRs (30d)
1

Description

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:

image

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at cy.checkA11y() and trace how violationCallback is handled alongside the standard output. Look for the existing logging path and related tests, if present. Done means custom Cypress logs remain visible while the standard accessibility output can be disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
cypress, typescript
Domain
accessibility, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.