Enable, validate, and demonstrate the use of built-in style definitions (fixes #593).

This commit is contained in:
David Anson 2022-10-02 19:28:54 -07:00
parent eb05bac07d
commit c383aab383
3 changed files with 21 additions and 4 deletions

View file

@ -12,7 +12,8 @@ const pluginSup = require("markdown-it-sup");
const pluginTexMath = require("markdown-it-texmath");
const test = require("ava").default;
const tv4 = require("tv4");
const { homepage, version } = require("../package.json");
const { "exports": packageExports, homepage, version } =
require("../package.json");
const markdownlint = require("../lib/markdownlint");
const constants = require("../lib/constants");
const rules = require("../lib/rules");
@ -430,11 +431,14 @@ test("enableTagMixedCase", (t) => new Promise((resolve) => {
}));
test("styleFiles", (t) => new Promise((resolve) => {
t.plan(4);
t.plan(7);
fs.readdir("./style", function readdir(err, files) {
t.falsy(err);
for (const file of files) {
t.truthy(require(path.join("../style", file)), "Unable to load/parse.");
const exportValue = `./style/${file}`;
const exportKey = exportValue.replace(/\.json$/, "");
t.is(packageExports[exportKey], exportValue);
}
resolve();
});
@ -1402,6 +1406,8 @@ test("getVersion", (t) => {
test("constants", (t) => {
t.plan(2);
// @ts-ignore
t.is(constants.homepage, homepage);
// @ts-ignore
t.is(constants.version, version);
});