Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axe-core

Package Overview
Dependencies
Maintainers
4
Versions
1376
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axe-core

Accessibility engine for automated Web UI testing

  • 4.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is axe-core?

The axe-core npm package is a library for accessibility testing. It allows developers to automatically test their HTML for common accessibility issues using a variety of technologies including JavaScript, React, Angular, Vue, and more. The package can be used in different environments like web browsers, Node.js, and continuous integration systems.

What are axe-core's main functionalities?

Accessibility testing in browser

This code sample demonstrates how to run accessibility tests on the current document in a web browser. The results are logged to the console.

axe.run(document, function(err, results) {
  if (err) throw err;
  console.log(results);
});

Integration with testing frameworks

This code sample shows how axe-core can be integrated with Jest testing framework using jest-axe to ensure that a rendered HTML snippet is accessible.

const { axe, toHaveNoViolations } = require('jest-axe');

test('ensures .foo element is accessible', async () => {
  const render = () => '<div class="foo">bar</div>';
  const html = render();
  expect(await axe(html)).toHaveNoViolations();
});

Command-line accessibility testing

This code sample illustrates how to use axe-core with axe-cli for command-line accessibility testing of a given URL.

const axe = require('axe-core');
const { run } = require('axe-cli');

run(axe, { url: 'http://example.com' }, (err, results) => {
  if (err) throw err;
  console.log(results);
});

Other packages similar to axe-core

Keywords

FAQs

Package last updated on 20 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc