Add test for commonmark spec (#18428)
This commit is contained in:
1 parent
a51ccb5779
commit
ce664cce5c
634 files changed
+2985
-2775
No files matched your search
@@ -136,6 +136,7 @@
|
||||
"browserslist-to-esbuild": "2.1.1",
|
||||
"buffer": "6.0.3",
|
||||
"c8": "10.1.3",
|
||||
"commonmark.json": "0.31.0",
|
||||
"cross-env": "10.1.0",
|
||||
"cspell": "9.3.2",
|
||||
"enquirer": "2.4.1",
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
+1885
-1475
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,38 @@
|
||||
import { commonmark as commonmarkTestSuite } from "commonmark.json";
|
||||
|
||||
const BUGS = new Set([
|
||||
"example-11.md",
|
||||
"example-43.md",
|
||||
"example-47.md",
|
||||
"example-77.md",
|
||||
"example-146.md",
|
||||
"example-196.md",
|
||||
"example-273.md",
|
||||
"example-274.md",
|
||||
"example-349.md",
|
||||
"example-417.md",
|
||||
"example-438.md",
|
||||
"example-493.md",
|
||||
]);
|
||||
|
||||
runFormatTest(
|
||||
{
|
||||
importMeta: import.meta,
|
||||
snippets: commonmarkTestSuite
|
||||
.map(({ section, markdown: input }, index) => {
|
||||
const filename = `example-${index + 1}.md`;
|
||||
if (BUGS.has(filename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
name: `example-${index + 1}.md (${section})`,
|
||||
filename,
|
||||
code: input,
|
||||
};
|
||||
})
|
||||
.filter(Boolean),
|
||||
},
|
||||
["markdown"],
|
||||
{ proseWrap: "always" },
|
||||
);
|
||||
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1 +0,0 @@
|
||||
`foo`
|
||||
@@ -1 +0,0 @@
|
||||
`` foo ` bar ``
|
||||
@@ -1 +0,0 @@
|
||||
` `` `
|
||||
@@ -1 +0,0 @@
|
||||
` `` `
|
||||
@@ -1 +0,0 @@
|
||||
` a`
|
||||
@@ -1 +0,0 @@
|
||||
` b `
|
||||
@@ -1,5 +0,0 @@
|
||||
``
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
``
|
||||
@@ -1,3 +0,0 @@
|
||||
``
|
||||
foo
|
||||
``
|
||||
@@ -1,2 +0,0 @@
|
||||
`foo bar
|
||||
baz`
|
||||
@@ -1 +0,0 @@
|
||||
foo baz bim
|
||||
@@ -1,2 +0,0 @@
|
||||
- `one
|
||||
- two`
|
||||
@@ -1,5 +0,0 @@
|
||||
```
|
||||
aaa
|
||||
aaa
|
||||
aaa
|
||||
```
|
||||
@@ -1,3 +0,0 @@
|
||||
```
|
||||
aaa
|
||||
```
|
||||
@@ -1,3 +0,0 @@
|
||||
```
|
||||
aaa
|
||||
```
|
||||
@@ -1,3 +0,0 @@
|
||||
```
|
||||
aaa
|
||||
```
|
||||
@@ -1,3 +0,0 @@
|
||||
```
|
||||
aaa
|
||||
```
|
||||
@@ -1,2 +0,0 @@
|
||||
``` ```
|
||||
aaa
|
||||
@@ -1,3 +0,0 @@
|
||||
~~~~~~
|
||||
aaa
|
||||
~~~ ~~
|
||||
@@ -1,5 +0,0 @@
|
||||
foo
|
||||
```
|
||||
bar
|
||||
```
|
||||
baz
|
||||
@@ -1,6 +0,0 @@
|
||||
foo
|
||||
---
|
||||
~~~
|
||||
bar
|
||||
~~~
|
||||
# baz
|
||||
@@ -1,5 +0,0 @@
|
||||
```ruby
|
||||
def foo(x)
|
||||
return 3
|
||||
end
|
||||
```
|
||||
@@ -1,5 +0,0 @@
|
||||
~~~~ ruby startline=3 $%@#$
|
||||
def foo(x)
|
||||
return 3
|
||||
end
|
||||
~~~~~~~
|
||||
@@ -1,2 +0,0 @@
|
||||
````;
|
||||
````
|
||||
@@ -1,2 +0,0 @@
|
||||
``` aa ```
|
||||
foo
|
||||
@@ -1,3 +0,0 @@
|
||||
```
|
||||
``` aaa
|
||||
```
|
||||
@@ -1,9 +0,0 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
hi
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
okay.
|
||||
@@ -1,3 +0,0 @@
|
||||
<div>
|
||||
*hello*
|
||||
<foo><a>
|
||||
@@ -1,2 +0,0 @@
|
||||
</div>
|
||||
*foo*
|
||||
@@ -1,5 +0,0 @@
|
||||
<DIV CLASS="foo">
|
||||
|
||||
*Markdown*
|
||||
|
||||
</DIV>
|
||||
@@ -1,3 +0,0 @@
|
||||
<div id="foo"
|
||||
class="bar">
|
||||
</div>
|
||||
@@ -1,3 +0,0 @@
|
||||
<div id="foo" class="bar
|
||||
baz">
|
||||
</div>
|
||||
@@ -1 +0,0 @@
|
||||
+++
|
||||
Loaded 100 of 634 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user