# @types/jest-axe

> TypeScript definitions for jest-axe

Latest version **3.5.9** (published 2023-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/jest-axe
pnpm add @types/jest-axe
yarn add @types/jest-axe
bun add @types/jest-axe
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.5.9 |
| Published | 2023-11-27 |
| First published | 2018-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51440 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/jest-axe
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest-axe
- npm.io page: https://npm.io/package/@types/jest-axe

## Dependencies (2)

- [axe-core](https://npm.io/package/axe-core.md) ^3.5.5
- [@types/jest](https://npm.io/package/@types/jest.md) *

## Recent versions

- 3.5.9 (latest) — 2023-11-27
- 3.5.5 (ts4.3) — 2022-09-24
- 3.5.3 (ts3.8) — 2021-09-21
- 3.5.0 (ts3.1) — 2020-07-20
- 3.2.1 (ts3.0) — 2019-10-25
- 2.2.2 (ts2.4) — 2018-10-28
- 3.5.8 — 2023-11-07
- 3.5.7 — 2023-10-18
- 3.5.6 — 2023-09-15
- 3.5.4 — 2022-06-17
- 3.5.2 — 2021-07-06
- 3.5.1 — 2020-10-20
- 3.2.2 — 2020-04-03
- 3.2.0 — 2019-10-22
- 2.2.4 — 2019-08-26
- … 3 more at https://npm.io/package/@types/jest-axe/versions

## README

# Installation
> `npm install --save @types/jest-axe`

# Summary
This package contains type definitions for jest-axe (https://github.com/nickcolley/jest-axe).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest-axe.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest-axe/index.d.ts)
````ts
/// <reference types="jest" />

import { AxeResults, ImpactValue, Result, RunOptions, Spec } from "axe-core";

export interface JestAxeConfigureOptions extends RunOptions {
    globalOptions?: Spec | undefined;
    impactLevels?: ImpactValue[];
}

/**
 * Version of the aXe verifier with defaults set.
 *
 * @remarks You can still pass additional options to this new instance;
 *          they will be merged with the defaults.
 */
export const axe: JestAxe;

/**
 * Runs aXe on HTML.
 *
 * @param html   Raw HTML string to verify with aXe.
 * @param options   Options to run aXe.
 * @returns Promise for the results of running aXe.
 */
export type JestAxe = (html: Element | string, options?: RunOptions) => Promise<AxeResults>;

/**
 * Creates a new aXe verifier function.
 *
 * @param options   Options to run aXe.
 * @returns New aXe verifier function.
 */
export function configureAxe(options?: JestAxeConfigureOptions): JestAxe;

/**
 * Results from asserting whether aXe verification passed.
 */
export interface AssertionsResult {
    /**
     * Actual checked aXe verification results.
     */
    actual: Result[];

    /**
     * @returns Message from the Jest assertion.
     */
    message(): string;

    /**
     * Whether the assertion passed.
     */
    pass: boolean;
}

/**
 * Asserts an aXe-verified result has no violations.
 *
 * @param results   aXe verification result, if not running via expect().
 * @returns Jest expectations for the aXe result.
 */
export type IToHaveNoViolations = (results?: Partial<AxeResults>) => AssertionsResult;

export const toHaveNoViolations: {
    toHaveNoViolations: IToHaveNoViolations;
};

declare global {
    namespace jest {
        interface Matchers<R, T> {
            toHaveNoViolations(): R;
        }
    }

    // axe-core depends on a global Node
    interface Node {}
}

declare module "@jest/expect" {
    interface Matchers<R extends void | Promise<void>> {
        toHaveNoViolations(): R;
    }
}

````

### Additional Details
 * Last updated: Mon, 27 Nov 2023 11:35:43 GMT
 * Dependencies: [@types/jest](https://npmjs.com/package/@types/jest), [axe-core](https://npmjs.com/package/axe-core)

# Credits
These definitions were written by [erbridge](https://github.com/erbridge).

---
_Source: https://npm.io/package/@types/jest-axe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
