From 30a0b2d2e030dc3d4230d97ce5e5f29e9bcc18f2 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sun, 12 Jul 2026 15:42:11 +0800 Subject: [PATCH] Rewrite tests for #17857 (#19609) --- tests/config/format-test/verify-fixtures.js | 2 +- .../list/__snapshots__/format.test.js.snap | 479 ------------------ .../__snapshots__/format.test.js.snap | 112 ++++ .../markdown/list/blank-lines/format.test.js | 1 + .../issue-17746-code-before-list.md | 0 .../issue-17746-code-sibling-nested-list.md | 0 ...ssue-17746-fenced-code-then-nested-list.md | 4 +- ...ue-17746-indented-code-then-nested-list.md | 0 .../list/{ => blank-lines}/issue-17746.md | 0 .../mdx/mdx/__snapshots__/format.test.js.snap | 170 ------- .../mdx/mdx/issue-17746-code-before-list.mdx | 4 - ...sue-17746-fenced-code-then-nested-list.mdx | 5 - ...e-17746-indented-code-then-nested-list.mdx | 3 - tests/format/mdx/mdx/issue-17746.mdx | 8 - 14 files changed, 116 insertions(+), 672 deletions(-) create mode 100644 tests/format/markdown/list/blank-lines/__snapshots__/format.test.js.snap create mode 100644 tests/format/markdown/list/blank-lines/format.test.js rename tests/format/markdown/list/{ => blank-lines}/issue-17746-code-before-list.md (100%) rename tests/format/markdown/list/{ => blank-lines}/issue-17746-code-sibling-nested-list.md (100%) rename tests/format/markdown/list/{ => blank-lines}/issue-17746-fenced-code-then-nested-list.md (93%) rename tests/format/markdown/list/{ => blank-lines}/issue-17746-indented-code-then-nested-list.md (100%) rename tests/format/markdown/list/{ => blank-lines}/issue-17746.md (100%) delete mode 100644 tests/format/mdx/mdx/issue-17746-code-before-list.mdx delete mode 100644 tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx delete mode 100644 tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx delete mode 100644 tests/format/mdx/mdx/issue-17746.mdx diff --git a/tests/config/format-test/verify-fixtures.js b/tests/config/format-test/verify-fixtures.js index bf7a5dbdd..0c76ba450 100644 --- a/tests/config/format-test/verify-fixtures.js +++ b/tests/config/format-test/verify-fixtures.js @@ -132,7 +132,7 @@ const categoryParsers = new Map([ ["lwc", { parsers: ["lwc"], verifyParsers: [], extensions: [".html"] }], [ "markdown", - { parsers: ["markdown"], verifyParsers: [], extensions: [".md"] }, + { parsers: ["markdown"], verifyParsers: ["mdx"], extensions: [".md"] }, ], ["mdx", { parsers: ["mdx"], verifyParsers: [], extensions: [".mdx"] }], [ diff --git a/tests/format/markdown/list/__snapshots__/format.test.js.snap b/tests/format/markdown/list/__snapshots__/format.test.js.snap index ce2b0e166..22a369c72 100644 --- a/tests/format/markdown/list/__snapshots__/format.test.js.snap +++ b/tests/format/markdown/list/__snapshots__/format.test.js.snap @@ -3613,485 +3613,6 @@ proseWrap: "always" ================================================================================ `; -exports[`issue-17746.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 0 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 4 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 999 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746.md - {"proseWrap":"always"} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 0 - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 4 - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 999 - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.md - {"proseWrap":"always"} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 0 - printWidth: 80 (default) | -=====================================input====================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -=====================================output===================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 4 - printWidth: 80 (default) | -=====================================input====================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -=====================================output===================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 999 - printWidth: 80 (default) | -=====================================input====================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -=====================================output===================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always"} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" - printWidth: 80 (default) | -=====================================input====================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -=====================================output===================================== -- a - \`\`\` - b - \`\`\` -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 0 - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b -- c - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -- c - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 4 - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b -- c - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -- c - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 999 - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b -- c - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -- c - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always"} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b -- c - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -- c - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 0 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 4 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" -tabWidth: 999 - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always"} format 1`] = ` -====================================options===================================== -parsers: ["markdown"] -proseWrap: "always" - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - exports[`long-paragraph.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` ====================================options===================================== parsers: ["markdown"] diff --git a/tests/format/markdown/list/blank-lines/__snapshots__/format.test.js.snap b/tests/format/markdown/list/blank-lines/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..b45daa0d4 --- /dev/null +++ b/tests/format/markdown/list/blank-lines/__snapshots__/format.test.js.snap @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`issue-17746.md format 1`] = ` +====================================options===================================== +parsers: ["markdown", "mdx"] + printWidth: 80 (default) | +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.md format 1`] = ` +====================================options===================================== +parsers: ["markdown", "mdx"] + printWidth: 80 (default) | +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-sibling-nested-list.md format 1`] = ` +====================================options===================================== +parsers: ["markdown", "mdx"] + printWidth: 80 (default) | +=====================================input====================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +=====================================output===================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.md format 1`] = ` +====================================options===================================== +parsers: ["markdown", "mdx"] + printWidth: 80 (default) | +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b +- c + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +- c + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.md format 1`] = ` +====================================options===================================== +parsers: ["markdown", "mdx"] + printWidth: 80 (default) | +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; diff --git a/tests/format/markdown/list/blank-lines/format.test.js b/tests/format/markdown/list/blank-lines/format.test.js new file mode 100644 index 000000000..68611c199 --- /dev/null +++ b/tests/format/markdown/list/blank-lines/format.test.js @@ -0,0 +1 @@ +runFormatTest(import.meta, ["markdown", "mdx"]); diff --git a/tests/format/markdown/list/issue-17746-code-before-list.md b/tests/format/markdown/list/blank-lines/issue-17746-code-before-list.md similarity index 100% rename from tests/format/markdown/list/issue-17746-code-before-list.md rename to tests/format/markdown/list/blank-lines/issue-17746-code-before-list.md diff --git a/tests/format/markdown/list/issue-17746-code-sibling-nested-list.md b/tests/format/markdown/list/blank-lines/issue-17746-code-sibling-nested-list.md similarity index 100% rename from tests/format/markdown/list/issue-17746-code-sibling-nested-list.md rename to tests/format/markdown/list/blank-lines/issue-17746-code-sibling-nested-list.md diff --git a/tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md b/tests/format/markdown/list/blank-lines/issue-17746-fenced-code-then-nested-list.md similarity index 93% rename from tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md rename to tests/format/markdown/list/blank-lines/issue-17746-fenced-code-then-nested-list.md index 39f855c1c..1d09653ac 100644 --- a/tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md +++ b/tests/format/markdown/list/blank-lines/issue-17746-fenced-code-then-nested-list.md @@ -2,5 +2,5 @@ a ``` - - b -- c + - b +- c diff --git a/tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md b/tests/format/markdown/list/blank-lines/issue-17746-indented-code-then-nested-list.md similarity index 100% rename from tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md rename to tests/format/markdown/list/blank-lines/issue-17746-indented-code-then-nested-list.md diff --git a/tests/format/markdown/list/issue-17746.md b/tests/format/markdown/list/blank-lines/issue-17746.md similarity index 100% rename from tests/format/markdown/list/issue-17746.md rename to tests/format/markdown/list/blank-lines/issue-17746.md diff --git a/tests/format/mdx/mdx/__snapshots__/format.test.js.snap b/tests/format/mdx/mdx/__snapshots__/format.test.js.snap index 86002f248..3b710e59b 100644 --- a/tests/format/mdx/mdx/__snapshots__/format.test.js.snap +++ b/tests/format/mdx/mdx/__snapshots__/format.test.js.snap @@ -368,176 +368,6 @@ opinionated-code-formatter-that-support-many-languages-and-integrate-with-most-e ================================================================================ `; -exports[`issue-17746.mdx - {"semi":false} format 1`] = ` -====================================options===================================== -parsers: ["mdx"] -semi: false - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746.mdx format 1`] = ` -====================================options===================================== -parsers: ["mdx"] - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -- c - - - - d - -=====================================output===================================== -- a - - - b - -- c - - - d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.mdx - {"semi":false} format 1`] = ` -====================================options===================================== -parsers: ["mdx"] -semi: false - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-code-before-list.mdx format 1`] = ` -====================================options===================================== -parsers: ["mdx"] - printWidth: 80 (default) | -=====================================input====================================== -- a - - b -- c -- d - -=====================================output===================================== -- a - - b -- c -- d - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.mdx - {"semi":false} format 1`] = ` -====================================options===================================== -parsers: ["mdx"] -semi: false - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -================================================================================ -`; - -exports[`issue-17746-fenced-code-then-nested-list.mdx format 1`] = ` -====================================options===================================== -parsers: ["mdx"] - printWidth: 80 (default) | -=====================================input====================================== -- \`\`\` - a - \`\`\` - - - b - -=====================================output===================================== -- \`\`\` - a - \`\`\` - - - b - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.mdx - {"semi":false} format 1`] = ` -====================================options===================================== -parsers: ["mdx"] -semi: false - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - -exports[`issue-17746-indented-code-then-nested-list.mdx format 1`] = ` -====================================options===================================== -parsers: ["mdx"] - printWidth: 80 (default) | -=====================================input====================================== -- a - - - b - -=====================================output===================================== -- a - - - b - -================================================================================ -`; - exports[`jsx.mdx - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["mdx"] diff --git a/tests/format/mdx/mdx/issue-17746-code-before-list.mdx b/tests/format/mdx/mdx/issue-17746-code-before-list.mdx deleted file mode 100644 index 58d20f0b6..000000000 --- a/tests/format/mdx/mdx/issue-17746-code-before-list.mdx +++ /dev/null @@ -1,4 +0,0 @@ -- a - - b -- c -- d diff --git a/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx b/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx deleted file mode 100644 index 8091b6b02..000000000 --- a/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx +++ /dev/null @@ -1,5 +0,0 @@ -- ``` - a - ``` - - - b diff --git a/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx b/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx deleted file mode 100644 index d74648228..000000000 --- a/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx +++ /dev/null @@ -1,3 +0,0 @@ -- a - - - b diff --git a/tests/format/mdx/mdx/issue-17746.mdx b/tests/format/mdx/mdx/issue-17746.mdx deleted file mode 100644 index d41254e55..000000000 --- a/tests/format/mdx/mdx/issue-17746.mdx +++ /dev/null @@ -1,8 +0,0 @@ -- a - - - b - -- c - - - - d