Skip to content

Example in README crashes #1021

@jrpool

Description

@jrpool

The Usage section of the README file contains the example:

import { Audit } from "@siteimprove/alfa-act";
import { Scraper } from "@siteimprove/alfa-scraper";

import rules from "@siteimprove/alfa-rules";

Scraper.with(async (scraper) => {
  for (const input of await scraper.scrape("http://example.com")) {
    const outcomes = await Audit.of(input, rules).evaluate();
  }
});

But this script executed with Node.js crashes on Audit.of() with the error message

TypeError: iterable is not iterable
    at Object.reduce (/Users/c162712/Documents/repos/autotest/node_modules/@siteimprove/alfa-iterable/src/iterable.js:70:29)
    at fromIterable (/Users/c162712/Documents/repos/autotest/node_modules/@siteimprove/alfa-list/src/list.js:467:41)
    at Function.from (/Users/c162712/Documents/repos/autotest/node_modules/@siteimprove/alfa-list/src/list.js:454:16)
    at Function.of (/Users/c162712/Documents/repos/autotest/node_modules/@siteimprove/alfa-act/src/audit.js:19:50)
    at file:///Users/c162712/Documents/repos/autotest/tests/alfastd.mjs:12:34

I believe this is because rules is not iterable.

Metadata

Metadata

Assignees

Labels

bugReport of unexpected or faulty behaviour in Alfa

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions