|
| 1 | +import { readFile } from "fs/promises"; |
1 | 2 | import { lint } from "markdownlint/async";
|
2 |
| -import { githubMarkdownLint } from "../src/rules"; |
| 3 | +import githubMarkdownLint from "../index.js"; |
3 | 4 |
|
4 | 5 | const exampleFileName = "./test/example.md";
|
5 |
| -const options = { |
6 |
| - config: { |
7 |
| - "no-duplicate-heading": true, |
8 |
| - "ol-prefix": "ordered", |
9 |
| - "no-space-in-links": false, |
10 |
| - "single-h1": true, |
11 |
| - "no-emphasis-as-heading": true, |
12 |
| - "no-empty-alt-text": false, |
13 |
| - "heading-increment": true, |
14 |
| - "no-generic-link-text": true, |
15 |
| - "ul-style": { |
16 |
| - style: "asterisk", |
17 |
| - }, |
18 |
| - default: false, |
19 |
| - "no-inline-html": false, |
20 |
| - "no-bare-urls": false, |
21 |
| - "no-blanks-blockquote": false, |
22 |
| - "fenced-code-language": true, |
23 |
| - "no-default-alt-text": true, |
24 |
| - "no-alt-text": true, |
25 |
| - }, |
26 |
| - files: [exampleFileName], |
27 |
| - customRules: githubMarkdownLint, |
28 |
| -}; |
29 | 6 |
|
30 | 7 | describe("when A11y rules applied", () => {
|
31 | 8 | test("fails expected rules", async () => {
|
| 9 | + const accessibilityRules = JSON.parse( |
| 10 | + await readFile(new URL("../style/accessibility.json", import.meta.url)), |
| 11 | + ); |
| 12 | + const options = { |
| 13 | + config: { |
| 14 | + default: false, |
| 15 | + ...accessibilityRules, |
| 16 | + }, |
| 17 | + files: [exampleFileName], |
| 18 | + customRules: githubMarkdownLint, |
| 19 | + }; |
| 20 | + |
32 | 21 | const result = await new Promise((resolve, reject) => {
|
33 | 22 | lint(options, (err, res) => {
|
34 | 23 | if (err) reject(err);
|
|
0 commit comments