# jest-axe "Expected the HTML found at $X to have no violations" in CI

> Fix jest-axe "Expected the HTML found at $X to have no violations" in CI - the toHaveNoViolations matcher found one or more real WCAG rule failures in the rendered markup.

Source: https://latchkey.dev/learn/ci-integrations/axe-core-expected-html-to-have-no-violations-in-ci  
Updated: 2026-06-30

jest-axe ran axe-core against your rendered component and `toHaveNoViolations()` failed because axe returned a non-empty violations array. The message lists each rule id, its impact, and the failing element selector.

## Diagnose it: did the report reach the service?

Coverage and quality integrations fail in two distinct places: the report was never produced, or it was produced and the upload was rejected. Establish which before touching tokens.

```Terminal
# 1. does the report exist and is it non-empty?
ls -la coverage/ && head -5 coverage/lcov.info

# 2. does it reference paths the service can map to the repo?
grep "^SF:" coverage/lcov.info | head -5

# 3. did the upload actually succeed, or just not fail the step?
# most uploaders exit 0 on a rejected upload unless told otherwise
```

> Absolute paths in an lcov report break file mapping on the service side, so coverage appears as zero even though the upload succeeded. Generate reports with paths relative to the repository root.

## FAQ

### What causes jest-axe "Expected the HTML found at $X to have no violations" in CI?

There are 2 common causes: the markup has a genuine wcag violation and a new component or change introduced the violation. axe-core matched one of its rules (missing alt, no accessible name, low contrast) against the DOM your component rendered.

### How do I fix jest-axe "Expected the HTML found at $X to have no violations" in CI?

There are 2 fixes depending on which cause you have: read the rule id and apply its documented fix and scope a justified exception, not a blanket disable. Work through them in order, since the first is the most common.

### What does jest-axe "Expected the HTML found at $X to have no violations" in CI actually mean?

A Jest test using expect(await axe(container)).toHaveNoViolations() fails with "Expected the HTML found at $(...) to have no violations:" followed by a rule id like color-contrast or image-alt and the offending node.

### How do I stop jest-axe "Expected the HTML found at $X to have no violations" in CI happening again?

Run jest-axe on every component in the test suite so violations surface at PR time. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
