Usage with Cypress
Cypress is a JavaScript end-to-end testing framework that runs your tests inside the browser itself, alongside the app under test. surea11y integrates through the @surea11y/cypress binding.
$ npm install @surea11y/cypress cypress
cypress is a peerDependencies entry — you need your own Cypress install for the types/runtime to resolve, same as writing any Cypress spec.
// cypress/e2e/my-page.cy.jsconst { A11yCoreBuilder } = require('@surea11y/cypress');it('has no accessibility violations', () => {cy.visit('https://example.com/');new A11yCoreBuilder().include('#main') // optional -- call multiple times for multi-region scans.exclude('.cookie-banner') // optional.withTags(['wcag2a', 'wcag2aa']).disableRules(['meta-refresh-no-exceptions']).analyze().then((results) => {const fails = results.checksResults.filter((r) => r.outcome === 'fail');expect(fails).to.have.length(0);});});
No { page }/{ browser }/{ driver } constructor argument, unlike the driver-based bindings — there's no such handle in Cypress. cy is ambient in every spec file and is the driver. analyze() returns a Cypress chainable, not a Promise — don't await it; call .then() as shown.
Also see a runnable example in the package's own repo.
Next: choose which rules run, integrate the scan into CI, and review the full result schema.