Socket
Socket
Sign inDemoInstall

@acot/core

Package Overview
Dependencies
177
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @acot/core

More accessible web, all over the world.


Version published
Weekly downloads
650
increased by62.09%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

0.0.19 (2022-06-05)

Bug Fixes

  • acot-reporter-pretty: fix stat bugs in testcase summary (f9a2552)
  • cli: support non TTY environment on preset test (48e3ce0)

Features

  • acot-preset-wcag: add invalid-id-reference rule (2a70d7e)
  • acot-runner-sitemap: add retry behavior to sitemap fetcher (fcc1293)
  • cli: add parallel option to preset test command (32f7e1e)
  • document: add progress indicator to documentation testing (756158b)

Readme

Source

@acot/core

This module is a low layer of acot.

Installation

Install via npm:

$ npm install --save @acot/core

Usage

The following is an example of using the @acot/acot-preset-wcag preset package. Learn @acot/core from how to use Simple and Advanced respectively.

Simple

In the simple example, it depends on the following package.

$ npm install --save puppeteer

The following is an example of specifying all audited pages and their configuration.

import { Acot, PresetLoader } from '@acot/core';

const cwd = process.cwd();

(async () => {
  const loader = new PresetLoader(cwd);

  const acot = new Acot({
    parallel: 4,
    origin: 'http://localhost:8000',
    presets: [loader.load('@acot/wcag')],
    cwd,
  });

  acot.add('/', {
    rules: {
      '@acot/wcag/page-has-title': ['error', null],
      '@acot/wcag/page-has-valid-lang': ['warn', null],
    },
  });

  const summary = await acot.audit();

  console.log('errorCount: %f', summary.errorCount);
  console.log('warningCount: %f', summary.warningCount);
  console.log('passCount: %f', summary.passCount);
})();

Advanced

In the advanced example, the following package is used.

The following is an example of performing an audit according to the configuration file (acot.config.js).

import { loadConfig, ConfigRouter } from '@acot/config';
import { findChrome } from '@acot/find-chrome';
import { Acot } from '@acot/core';

const cwd = process.cwd();

(async () => {
  const config = await loadConfig('.', { cwd });
  const router = new ConfigRouter(config);

  const acot = new Acot({
    parallel: 4,
    origin: 'http://localhost:8000',
    presets: config.presets ?? [],
    launchOptions: {
      executablePath: (await findChrome())!.executablePath,
    },
    cwd,
  });

  config.paths?.forEach((path) => {
    const entry = router.resolve(path);

    acot.add(path, {
      rules: entry.rules,
      presets: entry.presets,
      headers: entry.headers,
    });
  });

  const summary = await acot.audit();

  console.log('errorCount: %f', summary.errorCount);
  console.log('warningCount: %f', summary.warningCount);
  console.log('passCount: %f', summary.passCount);
})();

Keywords

FAQs

Last updated on 05 Jun 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc