Convert from tape test harness to ava, address minor declaration file issue.

This commit is contained in:
David Anson 2021-01-10 20:46:00 -08:00
parent 80069552b4
commit 49945d6601
12 changed files with 665 additions and 679 deletions

View file

@ -5,40 +5,37 @@
const fs = require("fs");
const path = require("path");
const globby = require("globby");
const tape = require("tape");
require("tape-player");
const test = require("ava").default;
const markdownlint = require("../lib/markdownlint");
const { utf8Encoding } = require("../helpers");
// Simulates typing each test file to validate handling of partial input
const files = fs.readdirSync("./test");
files.filter((file) => /\.md$/.test(file)).forEach((file) => {
const strings = {};
let content = fs.readFileSync(path.join("./test", file), utf8Encoding);
let content = fs.readFileSync(path.join("./test", file), "utf8");
while (content) {
strings[content.length.toString()] = content;
content = content.slice(0, -1);
}
tape(`type ${file}`, (test) => {
test.plan(1);
test(`type ${file}`, (t) => {
t.plan(1);
markdownlint.sync({
// @ts-ignore
strings,
"resultVersion": 0
});
test.pass();
test.end();
t.pass();
});
});
// Parses all Markdown files in all package dependencies
tape("parseAllFiles", (test) => {
test.plan(1);
test.cb("parseAllFiles", (t) => {
t.plan(1);
const options = {
"files": globby.sync("**/*.{md,markdown}")
};
markdownlint(options, (err) => {
test.ifError(err);
test.end();
t.falsy(err);
t.end();
});
});