JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 963612
  • Score
    100M100P100Q196876F
  • License MIT

Custom Vitest matcher for testing accessibility with aXe. Forked from jest-axe.

Package Exports

  • vitest-axe
  • vitest-axe/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vitest-axe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vitest-axe

Custom Vitest matcher for testing accessibility with aXe


version MIT License

Watch on GitHub

This library is a fork of jest-axe. It shares that library's implementation and API. It is intended to make it easier to include its matchers without clashes between Vitest and Jest's environment or types.

See the README for the original package for usage details.

Installation

This module should be installed as one of your project's devDependencies:

# with npm
npm install --save-dev vitest-axe
# yarn
yarn add --dev vitest-axe
# pnpm
pnpm add --dev vitest-axe

Usage

Import vitest-axe/extend-expect once (for instance in your tests setup file) and you're good to go:

// In your own vitest-setup.js (or any other name)
import "vitest-axe/extend-expect";

// In vitest.config.js add (if you haven't already)
export default defineConfig({
  test: {
    setupFiles: ["vitest-setup.js"],
  },
});

With TypeScript

If you're using TypeScript, make sure your setup file is a .ts and not a .js to include the necessary types.

You will also need to include your setup file in your tsconfig.json if you haven't already:

  // In tsconfig.json
  "include": [
    // ...
    "./vitest-setup.ts"
  ],