Add test for commonmark spec (#18428)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-12-06 00:24:51 +08:00
1 parent a51ccb5779
commit ce664cce5c
634 files changed
+2980 -2770

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import fs from "node:fs/promises";
import { commonmark } from "commonmark.json";
const existing = new Set(commonmark.map(({ markdown }) => markdown.trim()));
const DIRECTORY = new URL(
"../tests/format/markdown/legacy-spec/",
import.meta.url,
);
for (const file of await fs.readdir(DIRECTORY, { withFileTypes: true })) {
if (!file.isFile()) {
continue;
}
const fileUrl = new URL(file.name, DIRECTORY);
const content = await fs.readFile(fileUrl, "utf8");
if (existing.has(content.trim())) {
await fs.rm(new URL(file.name, DIRECTORY));
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ const FORMAT_TEST_DIRECTORY = path.join(PROJECT_ROOT, "tests/format/");
const TEST_SCRIPT_FILE_NAME = "format.test.js";
const SNAPSHOTS_DIRECTORY_NAME = "__snapshots__";
const IGNORED = new Set([
path.join(FORMAT_TEST_DIRECTORY, "markdown/spec/remark-bug"),
path.join(FORMAT_TEST_DIRECTORY, "markdown/spec-legacy/remark-bug"),
]);
async function* checkDirectory(directory) {