Switch to commonmark-test-suite (#18444)
This commit is contained in:
1 parent
88a41df74f
commit
8ee96d64e5
63 files changed
+1689
-1141
No files matched your search
@@ -1,19 +1,25 @@
|
||||
import fs from "node:fs/promises";
|
||||
import { commonmark } from "commonmark.json";
|
||||
import commonmarkTestSuite from "commonmark-test-suite";
|
||||
|
||||
const existing = new Set(commonmark.map(({ markdown }) => markdown.trim()));
|
||||
const DIRECTORY = new URL(
|
||||
"../tests/format/markdown/legacy-spec/",
|
||||
import.meta.url,
|
||||
const existing = new Set(
|
||||
Object.values(commonmarkTestSuite).flatMap((release) =>
|
||||
release.testCases.map(({ markdown }) => markdown.trim()),
|
||||
),
|
||||
);
|
||||
|
||||
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));
|
||||
const DIRECTORIES = [
|
||||
new URL("../tests/format/markdown/spec-legacy/", import.meta.url),
|
||||
];
|
||||
|
||||
for (const directory of DIRECTORIES) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user